/* BounceNot design tokens + shared primitives (plain CSS, no framework). */
:root {
    --light-bg: #f1f4f0;
    --accent-yellow: #f8c33f;
    --dark-burgundy: #4e1b2e;
    /* Brand orange, tuned to pass WCAG AA as text and under white button text (5.1:1 on white,
       4.6:1 on --light-bg). --orange-ink is for small text on orange tints (#fbe6de). */
    --orange-red: #c44221;
    --orange-hover: #a8381b;
    --orange-ink: #b43d1f;
    --yellow-ink: #8a6408;

    --white: #ffffff;
    --ink: #2a2126;
    --muted: #766c71;
    --border: #e4e0dd;
    --green: #2a7e4f;
    --green-bg: #e3f3ea;
    --red: #c0392b;
    --red-bg: #fbe7e4;
    --yellow-bg: #fdf3d6;
    --gray-bg: #eeeae7;

    --radius: 6px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 8px 24px rgba(78, 27, 46, 0.12);
    /* App pages: one horizontal gutter shared by header, content and footer so their edges line up. It
       equals the sidebar's icon inset (1rem padding + 0.75rem link padding), so the header logo sits on
       the icon column, and it is the same on both sides, so the header nav stays on the page centre. */
    --app-gutter: 1.75rem;
    /* One height scale for buttons and single-line controls, so any input/select/button row lines up. */
    --control-sm: 2rem;
    --control: 2.5rem;
    --control-lg: 3rem;
    --font: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
    min-height: 100%;
    margin: 0;
    padding: 0;
    font-family: var(--font);
    color: var(--ink);
    background: var(--light-bg);
    line-height: 1.6;
}

body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

body > main,
body > .app-shell {
    flex: 1 0 auto;
}

a { color: var(--orange-red); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3, h4 { color: var(--dark-burgundy); margin: 0 0 0.5rem; line-height: 1.25; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.15rem; }

p { margin: 0 0 1rem; }

.container { max-width: 1140px; margin: 0 auto; padding: 0 1rem; }

.muted { color: var(--muted); }
.text-center { text-align: center; }
.font-medium { font-weight: 600; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-yellow { color: var(--yellow-ink); }
.text-gray { color: #4b5563; }
.row { display: flex; gap: 1rem; }
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.wrap { flex-wrap: wrap; }
.grid { display: grid; gap: 1.25rem; }
/* Grid items default to min-width:auto, so one long unbreakable line (e.g. a curl command) would
   widen the column past the viewport; with 0 the code block scrolls inside itself instead. */
.grid > * { min-width: 0; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-5 { grid-template-columns: repeat(5, 1fr); }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; } .mb-3 { margin-bottom: 1.5rem; } .mb-4 { margin-bottom: 2rem; }
.overflow-x-auto { overflow-x: auto; }
.hidden { display: none !important; }

/* Forms */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-weight: 600; margin-bottom: 0.35rem; font-size: 0.9rem; }
.form-input, .form-textarea, .form-select {
    width: 100%;
    padding: 0.62rem 0.75rem;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    font-size: 0.95rem;
    font-family: inherit;
    background: var(--white);
}
.form-input:focus, .form-textarea:focus, .form-select:focus {
    outline: none;
    border-color: var(--orange-red);
    box-shadow: 0 0 0 3px rgba(196, 66, 33, 0.15);
}
.form-input, .form-select, .select { height: var(--control); }
.form-textarea { min-height: 140px; resize: vertical; }
/* Native checkboxes/radios carry a 3-4px UA margin that pushes them off the form's left edge; spacing
   comes from the label's gap instead. */
input[type="checkbox"], input[type="radio"] { margin: 0; width: 1rem; height: 1rem; flex: 0 0 auto; accent-color: var(--orange-red); }
.select { width: auto; min-width: 80px; padding: 0.62rem 0.75rem; border: 1px solid #d1d5db; border-radius: 4px; background: #fff; font: inherit; }
.form-card { max-width: 760px; }
/* Form buttons, everywhere: right-aligned, secondary (Cancel) first, the primary action last. */
.form-actions,
.form-footer-actions { display: flex; justify-content: flex-end; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.form-footer-actions { padding: 1.5rem; border-top: 1px solid #e5e7eb; }
.search-field { position: relative; flex: 1 1 240px; }
.search-field i { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: #9ca3af; }
.search-field .form-input { padding-left: 2.35rem; }

/* Tables */
table.data { width: 100%; border-collapse: collapse; background: var(--white); min-width: 720px; }
table.data th {
    text-align: left;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: #4b5563;
    background: #f9fafb;
    padding: 0.75rem 1.5rem;
    font-weight: 700;
}
table.data td { padding: 1rem 1.5rem; border-top: 1px solid #e5e7eb; font-size: 0.9rem; white-space: nowrap; }
table.data tr:hover td { background: #faf8f6; }
.table-header { background: #f9fafb; }

/* Every status pill (badge macro, list status, validation result) shares this geometry and palette. */
.badge,
.status-badge,
.validation-result {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    padding: 0.25rem 0.6rem;
    font-size: 0.75rem;
    font-weight: 700;
    line-height: 1;
}
.status-completed,
.result-valid,
.badge--valid,
.badge--completed { background: #dcfce7; color: #166534; }
.status-processing,
.result-warning,
.badge--processing,
.badge--warning,
.badge--pending { background: #fef3c7; color: #92400e; }
.status-empty,
.result-unknown,
.badge--empty,
.badge--unknown { background: #f3f4f6; color: #374151; }
.result-invalid,
.badge--invalid,
.badge--failed { background: #fee2e2; color: #991b1b; }
.status-warning { background: #ffedd5; color: #9a3412; }

.tabs { display: flex; gap: 0; overflow-x: auto; }
.tab {
    display: inline-flex;
    align-items: center;
    padding: 1rem 1.5rem;
    border-bottom: 2px solid transparent;
    color: #6b7280;
    font-weight: 600;
    white-space: nowrap;
}
.tab:hover { color: var(--orange-red); text-decoration: none; }
.tab.is-active,
.tab-active { color: var(--orange-red); border-bottom-color: var(--orange-red); }

.code-block {
    position: relative;
    background: #1e293b;
    color: #e2e8f0;
    border-radius: 6px;
    padding: 1rem;
    overflow-x: auto;
    font: 0.85rem/1.5 "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    white-space: pre;
}
.code-block code,
.code-block pre { color: inherit; font: inherit; margin: 0; white-space: pre; }
.info-note {
    background: #eff6ff;
    border: 1px solid #bfdbfe;
    border-radius: 6px;
    color: #1e40af;
    padding: 1rem;
}
/* Callout boxes (used on several pages). The last child's bottom margin would make the bottom padding
   larger than the top, so it is dropped. */
/* One yellow for every advisory callout (info box, API key notice, payment test mode). */
.info-box { background: #fffbeb; border: 1px solid #fde68a; border-radius: 6px; color: #92400e; padding: 1rem; }
.info-box > :last-child,
.danger-zone > :last-child,
.explanation-box > :last-child { margin-bottom: 0; }
.list-clean { list-style: none; padding: 0; margin: 0; }
.detail-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.75rem; }
.detail-list li { display: flex; justify-content: space-between; gap: 1rem; border-bottom: 1px solid #f1f5f9; padding-bottom: 0.75rem; }
.detail-list li:last-child { border-bottom: 0; padding-bottom: 0; }

@media (max-width: 860px) {
    .grid-3, .grid-4, .grid-5 { grid-template-columns: repeat(2, 1fr); }
    .grid-2 { grid-template-columns: 1fr; }
    table.data td, table.data th { padding: 0.75rem 1rem; }
}
@media (max-width: 860px) { :root { --app-gutter: 1rem; } }
@media (max-width: 560px) {
    .grid-2, .grid-3, .grid-4, .grid-5 { grid-template-columns: 1fr; }
}
/* Dense tables (emails): tighter cells so every column, incl. row actions, fits the content area. */
table.data--compact th, table.data--compact td { padding-left: 1rem; padding-right: 1rem; }
/* Outer cells keep the card's 1.5rem gutter so the table's edges line up with the card header above. */
table.data--compact th:first-child, table.data--compact td:first-child { padding-left: 1.5rem; }
table.data--compact th:last-child, table.data--compact td:last-child { padding-right: 1.5rem; }
/* A block checkbox is centred by the cell (inline it sits on the text baseline, a few px high). */
table.data input[type="checkbox"] { display: block; }
table.data--compact { min-width: 0; }
.form-input--readonly, .form-input[readonly] { background: var(--gray-bg); color: #4b5563; cursor: default; }

/* Long names/descriptions wrap inside a bounded column instead of pushing the other columns off-card. */
table.data td .list-cell__name { display: inline-block; max-width: 32rem; white-space: normal; }
table.data td .list-cell__desc {
    max-width: 32rem; white-space: normal; font-size: 0.85rem; margin-top: 0.15rem;
    display: -webkit-box; -webkit-line-clamp: 2; line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
@media (max-width: 600px) { table.data td .list-cell__name, table.data td .list-cell__desc { max-width: 14rem; } }
