/* Postlane app styles. Builds on /styles.css (same colors, type and width). */
:root {
  --danger: #c4312b;
  --danger-soft: #fdf0ef;
  --ok: #18794e;
  --ok-soft: #eaf7f0;
  --warn: #9a5b00;
  --warn-soft: #fff6e5;
  --card: #ffffff;
  --input: #ffffff;
}
@media (prefers-color-scheme: dark) {
  :root {
    --danger: #ff8a80;
    --danger-soft: #2a1716;
    --ok: #5fd39a;
    --ok-soft: #13241c;
    --warn: #f0b860;
    --warn-soft: #2a2213;
    --card: #15181e;
    --input: #0d0f13;
  }
  /* White on the light dark-mode accent is hard to read: use dark text on accent surfaces. */
  .btn, .seg input:checked + span { color: #0d0f13; }
}

[hidden] { display: none !important; }
img, video { max-width: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* Buttons */
.btn { border: 1px solid transparent; cursor: pointer; line-height: 1.3; font-size: 15px; }
.btn:hover { filter: brightness(1.06); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; filter: none; }
.btn:focus-visible, .btn-ghost:focus-visible, .btn-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-ghost { display: inline-block; white-space: nowrap; background: transparent; color: var(--text); border: 1px solid var(--line); padding: 9px 14px; border-radius: 10px; font-weight: 600; font-size: 14px; cursor: pointer; text-decoration: none; line-height: 1.3; }
.btn-ghost:hover { background: var(--soft); }
.btn-ghost:disabled { opacity: .55; cursor: not-allowed; }
.btn-danger { color: var(--danger); }
.btn-link { background: none; border: 0; padding: 0; color: var(--accent); cursor: pointer; font-weight: 600; text-decoration: underline; }
.btn-block { display: block; width: 100%; text-align: center; }

/* Notices */
.notice { border-radius: 10px; padding: 12px 14px; margin: 0 0 16px; border: 1px solid var(--line); background: var(--soft); font-size: 15px; display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; }
.notice p { margin: 0; color: inherit; }
.notice.error { background: var(--danger-soft); border-color: var(--danger); color: var(--danger); }
.notice.success { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.notice.warn { background: var(--warn-soft); border-color: var(--warn); color: var(--warn); }
.notice .close { background: none; border: 0; color: inherit; cursor: pointer; font-size: 20px; line-height: 1; padding: 0 2px; }

/* Forms */
.field { margin: 0 0 16px; }
.field > label, .field > .label { display: block; font-weight: 600; font-size: 15px; margin: 0 0 6px; }
.hint { color: var(--muted); font-size: 14px; margin: 6px 0 0; }
input[type="email"], input[type="password"], input[type="text"], input[type="datetime-local"], textarea {
  width: 100%; max-width: 100%; background: var(--input); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 16px; line-height: 1.4;
}
input:focus, textarea:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: var(--accent); }
textarea { resize: vertical; min-height: 110px; }
input[type="datetime-local"] { max-width: 280px; }

/* Auth pages */
.auth { max-width: 420px; margin: 0 auto; }
.auth h1 { font-size: 30px; }
.auth .card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
.auth .switch { margin: 18px 0 0; text-align: center; }
.auth .legal { color: var(--muted); font-size: 14px; margin: 14px 0 0; }

/* App header */
.app-header .wrap { gap: 12px; }
.app-header .brand { flex: none; }
.userbox { display: flex; align-items: center; gap: 12px; min-width: 0; }
.userbox .btn-ghost { flex: none; }
.userbox .email { color: var(--muted); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Sections */
.app main { padding-top: 32px; }
.section { margin: 0 0 40px; }
.section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin: 0 0 14px; }
.section-head h2 { margin: 0; }
.section-sub { color: var(--muted); font-size: 15px; margin: -6px 0 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 18px 20px; }

/* Accounts */
.accounts { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.account { display: flex; align-items: center; gap: 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; flex-wrap: wrap; }
.account.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.account .pick { display: flex; align-items: center; gap: 14px; flex: 1 1 220px; min-width: 0; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; }
.account .pick:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; border-radius: 8px; }
.avatar { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; flex: none; background: var(--soft); border: 1px solid var(--line); display: grid; place-items: center; font-weight: 700; color: var(--muted); overflow: hidden; }
.account .who { min-width: 0; }
.account .handle { font-weight: 700; display: block; overflow-wrap: anywhere; }
.account .meta { color: var(--muted); font-size: 14px; display: block; }
.account .actions { display: flex; align-items: center; gap: 8px; margin-left: auto; flex-wrap: wrap; }
.account .reconnect { flex: 1 1 100%; margin: 0; }
.badge { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .02em; padding: 2px 8px; border-radius: 999px; border: 1px solid currentColor; white-space: nowrap; vertical-align: middle; }
.badge.ok { color: var(--ok); background: var(--ok-soft); }
.badge.bad { color: var(--danger); background: var(--danger-soft); }
.badge.warn { color: var(--warn); background: var(--warn-soft); }
.badge.info { color: var(--accent); background: var(--soft); }
.badge.muted { color: var(--muted); background: var(--soft); }
.selected-tag { font-size: 12px; color: var(--accent); font-weight: 700; }
.empty { text-align: center; padding: 28px 20px; }
.empty p { color: var(--muted); margin: 0 auto 16px; max-width: 520px; }

/* New post */
.seg { display: flex; flex-wrap: wrap; gap: 8px; border: 0; padding: 0; margin: 0; }
.seg legend { font-weight: 600; font-size: 15px; margin: 0 0 6px; padding: 0; }
.seg label { position: relative; }
.seg input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.seg span { display: inline-block; padding: 8px 14px; border: 1px solid var(--line); border-radius: 999px; font-size: 15px; font-weight: 600; background: var(--input); cursor: pointer; }
.seg input:checked + span { background: var(--accent); border-color: var(--accent); color: #fff; }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.seg input:disabled + span { opacity: .55; cursor: not-allowed; }
.choices { display: grid; gap: 8px; border: 0; padding: 0; margin: 0; }
.choices legend { font-weight: 600; font-size: 15px; margin: 0 0 6px; padding: 0; }
.choices label { display: flex; gap: 10px; align-items: flex-start; font-size: 15px; cursor: pointer; }
.choices input { margin-top: 5px; flex: none; }
.choices small { display: block; color: var(--muted); font-size: 14px; }
.file-drop { position: relative; border: 1px dashed var(--line); border-radius: 10px; padding: 14px; background: var(--soft); display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.file-drop.dragging { border-color: var(--accent); background: var(--bg); }
.file-input { position: absolute; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.file-input:disabled + label { opacity: .55; cursor: not-allowed; }
.file-drop label.btn-ghost { background: var(--input); }
.file-name { color: var(--muted); font-size: 14px; min-width: 0; overflow-wrap: anywhere; flex: 1 1 160px; }
.preview { margin: 12px 0 0; }
.preview img, .preview video { display: block; max-height: 360px; border-radius: 10px; border: 1px solid var(--line); background: #000; }
.preview .file-info { color: var(--muted); font-size: 14px; margin: 6px 0 0; overflow-wrap: anywhere; }
.counter { color: var(--muted); font-size: 13px; text-align: right; margin: 4px 0 0; }
.counter.over { color: var(--danger); font-weight: 700; }
.trial-box { background: var(--soft); border: 1px solid var(--line); border-radius: 10px; padding: 14px; }
.trial-box .hint { margin: 0 0 10px; }
.form-actions { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 20px 0 0; }
.progress { margin: 16px 0 0; }
.progress .bar { height: 8px; background: var(--soft); border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.progress .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.progress p { margin: 6px 0 0; font-size: 14px; color: var(--muted); }
.locked { color: var(--muted); }

/* Activity */
.activity { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.activity li { padding: 12px 16px; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; background: var(--card); }
.activity li:first-child { border-top: 0; }
.activity .what { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.activity .what .cap { font-weight: 400; color: var(--muted); }
.activity .when { color: var(--muted); font-size: 14px; grid-column: 1 / -1; }
.activity .err { color: var(--danger); font-size: 14px; grid-column: 1 / -1; overflow-wrap: anywhere; }
.activity .status { justify-self: end; align-self: start; }
.activity a { font-size: 14px; }

/* Posts grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.post { background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: flex; flex-direction: column; min-width: 0; }
.post .thumb { position: relative; aspect-ratio: 4 / 5; background: var(--soft); display: block; }
.post .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post .thumb .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 14px; }
.post .thumb .kind { position: absolute; left: 8px; top: 8px; background: rgba(0,0,0,.65); color: #fff; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; }
.post .body { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.post .date { color: var(--muted); font-size: 13px; }
.post .caption { font-size: 14px; margin: 0; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; overflow-wrap: anywhere; }
.post .caption.none { color: var(--muted); font-style: italic; }
.metrics { display: grid; grid-template-columns: 1fr; gap: 2px; margin: 0; font-size: 13px; }
.metrics div { display: flex; justify-content: space-between; gap: 6px; min-width: 0; }
.metrics dt { color: var(--muted); min-width: 0; }
.metrics dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.metrics.none { display: block; color: var(--muted); }
.post .ig-link { font-size: 14px; margin-top: auto; }
.loading { color: var(--muted); padding: 18px 0; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; vertical-align: -2px; margin-right: 8px; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } .progress .bar i { transition: none; } }

/* Deletion status */
.status-card dl { display: grid; grid-template-columns: max-content 1fr; gap: 8px 16px; margin: 0; }
.status-card dt { color: var(--muted); }
.status-card dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }

@media (max-width: 560px) {
  .card, .auth .card { padding: 18px 16px; }
  .account { padding: 12px; }
  .account .actions { margin-left: 62px; }
  .grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .post .body { padding: 10px; }
  .userbox .email { max-width: 130px; }
  .userbox { gap: 8px; }
}
@media (max-width: 360px) {
  .grid { grid-template-columns: 1fr; }
}
