/* EveryBow Licenses - brand tokens from everybow_web (src/css/globalProperties.css). */

@font-face { font-family: 'Inter'; src: url('../fonts/inter-latin-variable.woff2') format('woff2'); font-weight: 100 900; font-display: swap; }
@font-face { font-family: 'Nunito Sans'; src: url('../fonts/nunito-sans-latin-variable.woff2') format('woff2'); font-weight: 200 1000; font-display: swap; }

:root {
    --navy: #244662;
    --navy-dark: #1d394f;
    --navy-deep: #172e40;
    --charcoal: #262c31;
    --silver: #c4ccd2;
    --white: #fff;
    --muted: #5f6d78;
    --line: #dfe5e9;
    --pale: #f3f6f8;
    --pale-blue: #eaf0f4;
    --heading: 'Nunito Sans', 'Segoe UI', sans-serif;
    --body: 'Inter', 'Segoe UI', sans-serif;
    --radius: 12px;
    --green: #1f7a4d; --green-bg: #e3f3ea;
    --amber: #8a5a00; --amber-bg: #fdf1d8;
    --red: #a3262a; --red-bg: #fbe6e6;
    --blue: #245f8f; --blue-bg: #e4eef7;
    --gray: #56636d; --gray-bg: #eceff1;
    color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--body); font-size: 15px; line-height: 1.55; color: var(--charcoal); background: var(--pale); }
a { color: var(--navy); text-decoration-color: #aebecb; text-underline-offset: 3px; }
a:hover { color: var(--navy-dark); text-decoration-color: var(--navy); }
h1, h2, h3, h4 { font-family: var(--heading); letter-spacing: -.02em; line-height: 1.2; color: var(--charcoal); margin: 0 0 .6em; }
h1 { font-size: 1.75rem; font-weight: 800; }
h2 { font-size: 1.2rem; font-weight: 750; }
h3 { font-size: 1rem; font-weight: 700; }
p { margin: 0 0 1em; }
code, .mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .9em; }
small, .muted { color: var(--muted); }
.small { font-size: .85rem; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }

/* ---- Brand ---- */
.brand { display: inline-flex; gap: 11px; align-items: center; color: inherit; text-decoration: none; }
.brand-mark { width: 40px; height: 30px; flex: none; color: currentColor; }
.brand-name { font-family: var(--heading); font-size: 1.35rem; line-height: 1.05; font-weight: 800; letter-spacing: -.04em; }
.brand-descriptor { display: block; font-family: var(--body); font-size: .62rem; letter-spacing: .14em; font-weight: 600; margin-top: 4px; opacity: .8; }

/* ---- App shell ---- */
.app-shell { display: grid; grid-template-columns: 250px 1fr; min-height: 100vh; }
.sidebar { background: var(--navy); color: #fff; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.sidebar .brand { padding: 22px 20px 18px; color: #fff; }
.sidebar nav { flex: 1; padding: 6px 10px; }
.nav-heading { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: #a9bccb; font-weight: 600; margin: 18px 10px 6px; }
.nav-link { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; color: #e6edf2; text-decoration: none; font-size: .92rem; font-weight: 500; }
.nav-link svg { width: 18px; height: 18px; flex: none; opacity: .85; }
.nav-link:hover { background: rgba(255, 255, 255, .08); color: #fff; }
.nav-link.active { background: #fff; color: var(--navy); font-weight: 600; }
.nav-link.active svg { opacity: 1; }
.nav-badge { margin-left: auto; background: #fff; color: var(--navy); border-radius: 999px; font-size: .72rem; font-weight: 700; padding: 1px 7px; }
.nav-link.active .nav-badge { background: var(--navy); color: #fff; }
.sidebar-foot { padding: 14px 20px 18px; border-top: 1px solid rgba(255, 255, 255, .12); font-size: .82rem; color: #c9d6df; }
.sidebar-foot a, .sidebar-foot button { color: #fff; }
.sidebar-foot .link-button { color: #fff; }
.mode-pill { display: inline-block; font-size: .68rem; letter-spacing: .08em; font-weight: 700; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; background: #f5c451; color: #3a2a00; }
.mode-pill.live { background: #7ed3a5; color: #08311c; }

.main { min-width: 0; }
.topbar { display: none; }
.content { padding: 30px 36px 60px; max-width: 1280px; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-head h1 { margin: 0; }
.page-head .sub { color: var(--muted); margin: 4px 0 0; }
.page-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumbs { font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.crumbs a { color: var(--muted); }

/* ---- Cards & grids ---- */
.card { --pad-y: 20px; --pad-x: 22px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: var(--pad-y) var(--pad-x); margin-bottom: 20px; min-width: 0; }
.card > h2:first-child, .card-head h2 { margin-bottom: 14px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.card-head h2 { margin-bottom: 14px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush > .card-head { padding: 18px var(--pad-x) 0; }
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-side { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.grid > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 20px; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 22px; }
.stat { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; text-decoration: none; color: inherit; display: block; }
a.stat:hover { border-color: var(--silver); }
.stat-label { font-size: .75rem; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); font-weight: 600; }
.stat-value { font-family: var(--heading); font-size: 1.7rem; font-weight: 800; color: var(--navy); letter-spacing: -.03em; line-height: 1.2; margin-top: 4px; }
.stat-note { font-size: .82rem; color: var(--muted); }
.stat.warn .stat-value { color: var(--red); }

dl.facts { display: grid; grid-template-columns: max-content 1fr; gap: 8px 18px; margin: 0; }
dl.facts dt { color: var(--muted); font-size: .88rem; }
dl.facts dd { margin: 0; overflow-wrap: anywhere; }

/* ---- Tables ---- */
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.table th { text-align: left; font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; background: #fafbfc; }
.table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover td { background: #fafcfd; }
.table .num, .table th.num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.table .nowrap { white-space: nowrap; }
.table tfoot td { font-weight: 700; border-top: 2px solid var(--line); }
.table th.sortable a { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 4px; }
.table th.sortable a:hover { color: var(--navy); }
.table th.sorted, .table th.sorted a { color: var(--navy); }
.sort-arrow { font-size: .62rem; min-width: .7em; }
.table th.sortable:not(.sorted) a:hover .sort-arrow::after { content: '▲'; opacity: .35; }
.card > .table-wrap { margin: 0 calc(-1 * var(--pad-x)) calc(-1 * var(--pad-y)); }
.card > .table-wrap:not(:last-child) { margin-bottom: 16px; }
.card.flush > .table-wrap { margin: 0; }
.card > .table-wrap .table th:first-child, .card > .table-wrap .table td:first-child { padding-left: var(--pad-x); }
.card > .table-wrap .table th:last-child, .card > .table-wrap .table td:last-child { padding-right: var(--pad-x); }
.empty { color: var(--muted); padding: 18px 0; text-align: center; }

/* ---- Badges ---- */
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: .76rem; font-weight: 600; white-space: nowrap; background: var(--gray-bg); color: var(--gray); }
.badge-active, .badge-paid, .badge-resolved, .badge-valid, .badge-ok { background: var(--green-bg); color: var(--green); }
.badge-pending, .badge-open, .badge-waiting { background: var(--blue-bg); color: var(--blue); }
.badge-paused, .badge-partially-refunded, .badge-high { background: var(--amber-bg); color: var(--amber); }
.badge-suspended, .badge-failed, .badge-uncollectible, .badge-urgent, .badge-url-mismatch, .badge-unknown-key, .badge-invalid-key, .badge-inactive, .badge-past-due { background: var(--red-bg); color: var(--red); }
.badge-completed { background: #e7eef5; color: var(--navy); }
.badge-archived, .badge-void, .badge-closed, .badge-refunded, .badge-low { background: var(--gray-bg); color: var(--gray); }

/* ---- Forms ---- */
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 18px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 14px; }
.form-grid .field { margin-bottom: 0; }
label, .label { font-size: .85rem; font-weight: 600; color: var(--charcoal); }
.hint { font-size: .8rem; color: var(--muted); font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], input[type=search], input[type=url], select, textarea {
    font: inherit; font-size: .93rem; width: 100%; padding: 9px 11px; border: 1px solid #cdd6dc; border-radius: 7px; background: #fff; color: var(--charcoal);
}
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(36, 70, 98, .25); border-color: var(--navy); }
textarea { min-height: 110px; resize: vertical; }
textarea.code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: .85rem; min-height: 380px; }
.checkbox-row { display: flex; gap: 9px; align-items: flex-start; font-weight: 500; }
.checkbox-row input { margin-top: 4px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 18px; flex-wrap: wrap; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px 4px; margin: 0 0 16px; }
legend { font-weight: 700; padding: 0 6px; font-family: var(--heading); }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: flex-end; margin-bottom: 16px; }
.filters .field { margin: 0; }
.filters input, .filters select { width: auto; min-width: 150px; }
.filters input[type=search], .filters input[name=q] { min-width: 270px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tab { padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line); background: #fff; text-decoration: none; font-size: .85rem; color: var(--charcoal); }
.tab:hover { border-color: var(--silver); }
.tab.active { background: var(--navy); border-color: var(--navy); color: #fff; }
.tab .count { opacity: .7; margin-left: 4px; }

/* ---- Buttons (everybow_web .button) ---- */
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--navy); color: #fff; border: 1px solid transparent; padding: 9px 16px; border-radius: 7px; font: inherit; font-size: .9rem; font-weight: 600; line-height: 1.4; text-decoration: none; cursor: pointer; white-space: nowrap; transition: background .2s, transform .2s; }
.button:hover { background: var(--navy-dark); color: #fff; transform: translateY(-1px); }
.button-small { padding: 6px 12px; font-size: .82rem; }
.button-large { padding: 14px 24px; font-size: .95rem; min-height: 52px; }
.button-ghost { background: #fff; color: var(--navy); border-color: var(--line); }
.button-ghost:hover { background: var(--pale-blue); color: var(--navy); }
.button-danger { background: var(--red); }
.button-danger:hover { background: #821d21; }
.link-button { background: none; border: 0; padding: 0; font: inherit; color: var(--navy); text-decoration: underline; text-decoration-color: #aebecb; text-underline-offset: 3px; cursor: pointer; }
form.inline { display: inline; }

/* ---- Alerts ---- */
.alert { padding: 12px 16px; border-radius: 9px; margin-bottom: 18px; border: 1px solid transparent; font-size: .92rem; }
.alert-success { background: var(--green-bg); color: #155c39; border-color: #bfe2cf; }
.alert-error { background: var(--red-bg); color: #7d1c20; border-color: #f1c2c3; }
.alert-warning { background: var(--amber-bg); color: #6b4600; border-color: #f2d9a2; }
.alert-info { background: var(--pale-blue); color: var(--navy-dark); border-color: #d2dfe8; }
.plain-list { margin: 0; padding-left: 18px; }

/* ---- License key box ---- */
.keybox { display: flex; align-items: center; gap: 10px; background: var(--pale); border: 1px dashed var(--silver); border-radius: 9px; padding: 10px 12px; }
.keybox code { font-size: 1rem; letter-spacing: .04em; flex: 1; overflow-wrap: anywhere; }
pre.snippet { background: var(--charcoal); color: #e9eef2; border-radius: 9px; padding: 14px 16px; overflow-x: auto; font-size: .82rem; margin: 0; }

/* ---- Timeline (events, ticket entries) ---- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 22px; border-left: 2px solid var(--line); margin-left: 6px; }
.timeline li:last-child { border-left-color: transparent; }
.timeline li::before { content: ''; position: absolute; left: -7px; top: 4px; width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 2px solid var(--silver); }
.timeline li.status::before { border-color: var(--navy); background: var(--navy); }
.timeline .meta { font-size: .78rem; color: var(--muted); }
.entry { border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin-bottom: 12px; background: #fff; }
.entry.entry-note { background: #fffdf5; border-color: #f0e6c4; }
.entry.entry-system { background: transparent; border-style: dashed; padding: 8px 14px; font-size: .85rem; color: var(--muted); }
.entry.entry-email_in { border-left: 4px solid var(--blue); }
.entry.entry-email_out { border-left: 4px solid var(--green); }
.entry-head { display: flex; justify-content: space-between; gap: 10px; font-size: .8rem; color: var(--muted); margin-bottom: 6px; flex-wrap: wrap; }
.entry-head strong { color: var(--charcoal); }

/* ---- Bar chart ---- */
.bars { display: flex; align-items: flex-end; gap: 6px; height: 200px; padding-top: 18px; border-bottom: 1px solid var(--line); }
.bar { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; height: 100%; min-width: 0; position: relative; }
.bar-fill { width: 100%; max-width: 46px; background: var(--navy); border-radius: 5px 5px 0 0; min-height: 2px; }
.bar.current .bar-fill { background: #6f8ca5; }
.bar-value { font-size: .68rem; color: var(--muted); margin-bottom: 3px; white-space: nowrap; }
.bar-labels { display: flex; gap: 6px; margin-top: 6px; }
.bar-labels span { flex: 1; text-align: center; font-size: .72rem; color: var(--muted); min-width: 0; overflow: hidden; }

/* ---- Agreement document ---- */
.agreement { font-size: .95rem; line-height: 1.7; }
.agreement h1, .agreement h2, .agreement h3 { color: var(--navy); margin-top: 1.4em; }
.agreement h2:first-child { margin-top: 0; }
.agreement-scroll { max-height: 460px; overflow-y: auto; border: 1px solid var(--line); border-radius: 10px; padding: 20px 24px; background: #fff; }

.pager { display: flex; align-items: center; gap: 12px; justify-content: center; margin-top: 18px; font-size: .88rem; color: var(--muted); }
details summary { cursor: pointer; font-weight: 600; color: var(--navy); }
details[open] summary { margin-bottom: 12px; }

/* ---- Public (customer) pages & login ---- */
.public-body { background: var(--pale); }
.public-header { background: #fff; border-bottom: 1px solid #edf0f2; }
.public-header-inner { max-width: 880px; margin: 0 auto; padding: 18px 20px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.public-header .brand { color: var(--navy); }
.public-header .brand-descriptor { color: var(--charcoal); }
.public-main { max-width: 880px; margin: 0 auto; padding: 34px 20px 70px; }
.public-main.narrow { max-width: 440px; }
.public-footer { text-align: center; color: #7a8893; font-size: .8rem; padding: 0 20px 40px; }
.summary-band { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.summary-band div { background: var(--pale); border-radius: 9px; padding: 12px 14px; }
.summary-band span { display: block; font-size: .72rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.summary-band strong { font-family: var(--heading); font-size: 1.1rem; color: var(--navy); }
.login-card { margin-top: 40px; }

/* ---- Responsive ---- */
@media (max-width: 1050px) {
    .grid-side, .grid-3 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
    .app-shell { grid-template-columns: minmax(0, 1fr); }
    .sidebar { position: fixed; inset: 0 auto 0 0; width: 260px; transform: translateX(-100%); transition: transform .2s; z-index: 40; }
    .nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .3); }
    .topbar { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 30; }
    .topbar .brand { color: #fff; }
    .topbar button { background: none; border: 1px solid rgba(255, 255, 255, .35); color: #fff; border-radius: 7px; padding: 6px 10px; font-size: 1.1rem; cursor: pointer; }
    .content { padding: 22px 16px 50px; }
    .card { --pad-y: 16px; --pad-x: 16px; }
    .card.flush > .card-head { padding-top: 14px; }
    .page-head h1 { font-size: 1.45rem; overflow-wrap: anywhere; }
    .keybox { flex-wrap: wrap; }
    .keybox code { font-size: .9rem; }
    dl.facts { grid-template-columns: 1fr; gap: 2px 0; }
    dl.facts dd { margin-bottom: 8px; }
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .stat-value { font-size: 1.35rem; overflow-wrap: anywhere; }
    .agreement-scroll { padding: 14px 16px; }
    .bar-value { font-size: .6rem; }
    .summary-band { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
    .public-main { padding: 24px 16px 50px; }
    .grid-2, .form-grid { grid-template-columns: minmax(0, 1fr); }
    .filters input, .filters select { min-width: 0; width: 100%; }
    .filters .field { flex: 1 1 140px; }
    .filters input[type=search], .filters input[name=q] { min-width: 0; }
}
@media print {
    .sidebar, .topbar, .page-actions, .no-print { display: none !important; }
    .app-shell { display: block; }
    body { background: #fff; }
}
