/* Admin and auth */
.admin-body, .auth-body, .editor-page { background: var(--lilac-3); font-size: 15px; }
.admin { min-height: 100vh; }
.admin-top { display: flex; align-items: center; gap: 1.5rem; padding: .7rem 1.25rem; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.admin-brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--navy); font-weight: 800; }
.admin-brand img { width: 110px; }
.admin-nav { display: flex; gap: .25rem; flex: 1; overflow-x: auto; }
.admin-nav a { padding: .5rem .8rem; border-radius: 10px; text-decoration: none; color: var(--ink-soft); font-weight: 700; white-space: nowrap; }
.admin-nav a:hover { background: var(--lilac-3); color: var(--navy); }
.admin-nav a.is-active { background: var(--lilac-2); color: var(--navy); }
.admin-user { display: flex; align-items: center; gap: .75rem; }
.admin-main { max-width: 1100px; margin: 0 auto; padding: 1.5rem 1.25rem 4rem; }
.admin-main.is-wide { max-width: 1320px; }
@media (max-width: 700px) { .admin-top { flex-wrap: wrap; gap: .5rem; } .admin-nav { order: 3; width: 100%; } }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.page-head h1 { font-size: 1.7rem; margin: 0; }
.crumbs { margin: 0 0 .25rem; color: var(--ink-muted); font-size: .9rem; }
.crumbs a { color: inherit; }
.meta-line { margin: .4rem 0 0; }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.action-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.inline { display: inline; }

.card { background: #fff; border-radius: 16px; padding: 1.25rem 1.5rem; margin-bottom: 1rem; box-shadow: 0 2px 10px rgba(9,0,46,.04); }
.card h2 { font-size: 1.05rem; margin-bottom: .9rem; }
.card h3 { font-size: .95rem; margin-bottom: .5rem; }
.card-signed { border: 2px solid var(--green); }
.form-narrow { max-width: 680px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0 1rem; }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0 1rem; align-items: end; }
@media (max-width: 700px) { .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; } }
.two-col { display: grid; gap: 1rem; }
@media (min-width: 1000px) { .two-col { grid-template-columns: 1fr 1fr; align-items: start; } }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: .35rem 1.25rem; margin: 0; }
.kv dt { color: var(--ink-muted); font-size: .9rem; }
.kv dd { margin: 0; }
.check { display: flex; align-items: center; gap: .5rem; margin-bottom: .8rem; }
.check input { width: 18px; height: 18px; accent-color: var(--red); }
.checks { display: flex; flex-wrap: wrap; gap: .25rem 1.25rem; }
.checks .check { margin: .25rem 0; }
.btn-block { width: 100%; }
.btn-danger { background: #fff; color: var(--red-dark); border-color: var(--red); }
.btn-danger:hover { background: var(--red); color: #fff; }

.alert { border-radius: 12px; padding: .8rem 1rem; margin-bottom: 1rem; font-weight: 700; word-break: break-word; }
.alert-ok { background: #e6f4dd; color: #2a5a1a; }
.alert-error { background: #fde8ee; color: #9b1239; }
.alert-info { background: var(--lilac-2); color: var(--ink-soft); font-weight: 400; }

.stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1.25rem; }
@media (min-width: 800px) { .stats { grid-template-columns: repeat(4, 1fr); } }
.stat { background: #fff; border-radius: 14px; padding: 1rem 1.15rem; display: flex; flex-direction: column; }
.stat-label { font-size: .78rem; font-weight: 800; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-muted); }
.stat-value { font-size: 1.6rem; font-weight: 800; margin: .2rem 0; }
.stat-sub { font-size: .82rem; color: var(--ink-muted); }

.toolbar { display: flex; justify-content: space-between; align-items: center; gap: 1rem; margin-bottom: .75rem; flex-wrap: wrap; }
.tabs { display: flex; gap: .25rem; flex-wrap: wrap; }
.tabs a { padding: .45rem .8rem; border-radius: 999px; text-decoration: none; color: var(--ink-soft); font-weight: 700; font-size: .9rem; }
.tabs a.is-active { background: var(--navy); color: #fff; }
.tabs .count { opacity: .6; font-weight: 400; margin-left: .2rem; }
.search input { min-width: 260px; }

table.list { width: 100%; border-collapse: collapse; background: #fff; border-radius: 14px; overflow: hidden; }
table.list th, table.list td { text-align: left; padding: .8rem 1rem; border-bottom: 1px solid var(--line); vertical-align: top; }
table.list th { font-size: .78rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-muted); background: var(--lilac-3); }
table.list td.num, table.list th.num { text-align: right; white-space: nowrap; }
table.list .row-title { font-weight: 700; display: block; color: var(--navy); }
table.list td .small { display: block; }
table.list tr.is-hidden { opacity: .55; }
table.list td.empty { text-align: center; color: var(--ink-muted); padding: 2rem; }
table.list.compact td { padding: .45rem .75rem; font-size: .9rem; }
.input-inline { width: auto; display: inline-block; padding: .4rem .6rem; font-size: .9rem; margin: .1rem .2rem .1rem 0; max-width: 220px; }
.input-short { max-width: 120px; }
.inline-edit { display: flex; flex-wrap: wrap; gap: .25rem; align-items: center; }

.pill { display: inline-block; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; padding: .2rem .55rem; border-radius: 999px; background: var(--lilac); color: var(--navy); margin-right: .25rem; }
.pill-draft { background: var(--lilac); }
.pill-sent { background: #fff3c4; color: #6b4e00; }
.pill-accepted, .pill-paid { background: #dcf1d0; color: #2a5a1a; }
.pill-lost { background: #fde8ee; color: #9b1239; }
.pill-expired { background: #eee; color: #555; }

.recipient { display: flex; justify-content: space-between; gap: 1rem; padding: .6rem 0; border-top: 1px solid var(--line); }
.recipient:first-of-type { border-top: 0; }
ul.plain { list-style: none; padding: 0; margin: 0; }
ul.plain li { padding: .3rem 0; border-top: 1px solid var(--line); }
ul.plain li:first-child { border-top: 0; }

.timeline { list-style: none; margin: 0; padding: 0; }
.tl { display: grid; grid-template-columns: 14px 1fr; gap: .75rem; padding: .5rem 0; position: relative; }
.tl::before { content: ''; position: absolute; left: 6px; top: 0; bottom: 0; width: 2px; background: var(--line); }
.tl-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--purple); margin-top: .3rem; position: relative; z-index: 1; border: 3px solid #fff; }
.tl-signed .tl-dot { background: #4caf50; }
.tl-sent .tl-dot, .tl-resent .tl-dot { background: var(--navy); }
.tl-opened .tl-dot { background: var(--red); }
.tl-lost .tl-dot, .tl-revoked .tl-dot { background: #999; }
.tl-text { font-weight: 700; }
.section-times { margin-bottom: 1.25rem; }
.bar-row { display: grid; grid-template-columns: 1fr 2fr auto; gap: .6rem; align-items: center; font-size: .85rem; margin-bottom: .3rem; }
.bar { height: 8px; background: var(--lilac-2); border-radius: 4px; overflow: hidden; }
.bar-fill { display: block; height: 100%; background: var(--purple); }
.bar-val { color: var(--ink-muted); white-space: nowrap; }

/* Auth */
.auth { max-width: 420px; margin: 0 auto; padding: 3rem 1.25rem; }
.auth-logo { width: 150px; margin: 0 auto 1.5rem; }
.auth-card { background: #fff; border-radius: 18px; padding: 2rem; box-shadow: var(--shadow); }
.auth-card h1 { font-size: 1.5rem; margin-bottom: 1rem; }
.auth-foot { text-align: center; margin-top: 1.5rem; }
.code-input { font-size: 1.6rem !important; letter-spacing: .3em; text-align: center; }
.qr { width: 220px; margin: .5rem auto 1rem; background: #fff; }
.qr svg { width: 100%; height: auto; }
.secret { word-break: break-all; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .85em; background: var(--lilac-3); padding: .1rem .3rem; border-radius: 4px; }
