:root {
    --ink: #17201d;
    --muted: #64706b;
    --paper: #f3f1e9;
    --panel: #fffef9;
    --line: #d9d8cf;
    --accent: #ff5a36;
    --accent-dark: #cf3a1d;
    --deep: #122923;
    --mint: #d5f3dd;
    --danger: #7e3124;
    --shadow: 0 18px 55px rgba(23, 32, 29, 0.08);
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--paper); }
body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        linear-gradient(rgba(23, 32, 29, 0.035) 1px, transparent 1px),
        linear-gradient(90deg, rgba(23, 32, 29, 0.035) 1px, transparent 1px),
        var(--paper);
    background-size: 32px 32px;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
a { color: inherit; }
button, input, select, textarea { font: inherit; }

.topbar {
    min-height: 72px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    padding: 12px clamp(20px, 5vw, 72px);
    color: #f8f5e9;
    background: var(--deep);
    border-bottom: 3px solid var(--accent);
}
.brand { display: inline-flex; align-items: center; gap: 12px; color: inherit; text-decoration: none; font-weight: 760; letter-spacing: -0.02em; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; color: var(--deep); background: var(--accent); border-radius: 50%; font-size: 13px; letter-spacing: 0.02em; }
.topnav { display: flex; align-items: center; gap: 24px; }
.topnav a, .top-login, .nav-button { color: inherit; border: 0; background: none; text-decoration: none; font-size: 14px; cursor: pointer; opacity: 0.82; }
.topnav a:hover, .top-login:hover, .nav-button:hover { opacity: 1; }
.topnav form { margin: 0; }

.page-shell { width: min(1180px, calc(100% - 40px)); min-height: calc(100vh - 148px); margin: 0 auto; padding: 52px 0 72px; }
.footer { min-height: 76px; display: flex; justify-content: space-between; gap: 20px; padding: 25px clamp(20px, 5vw, 72px); color: #d9e2dc; background: var(--deep); font-size: 13px; }
.footer a { color: inherit; }
.eyebrow { margin: 0 0 14px; color: var(--accent-dark); font-size: 12px; font-weight: 850; letter-spacing: 0.16em; }
h1, h2 { font-family: Georgia, "Times New Roman", serif; letter-spacing: -0.035em; }
h1 { margin: 0; font-size: clamp(38px, 6vw, 72px); line-height: 0.98; }
h2 { font-size: 27px; }

.landing-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(280px, 0.75fr); gap: clamp(30px, 7vw, 90px); align-items: end; padding: 5vh 0; }
.landing-copy h1 { max-width: 760px; }
.landing-lead { max-width: 730px; margin: 30px 0 0; color: #48534e; font-size: clamp(18px, 2.2vw, 24px); line-height: 1.55; }
.landing-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 36px; }
.landing-card { padding: 30px; color: #f6f1e4; background: var(--deep); border-radius: 2px; box-shadow: var(--shadow); }
.landing-card h2 { margin: 22px 0 10px; }
.landing-card p { margin: 0; color: #c7d3cd; line-height: 1.65; }
.card-number { display: block; color: var(--accent); font: 700 64px/1 Georgia, serif; }

.button { display: inline-flex; min-height: 46px; align-items: center; justify-content: center; padding: 0 20px; border: 1px solid transparent; border-radius: 2px; text-decoration: none; font-weight: 760; cursor: pointer; }
.button.primary { color: #fff; background: var(--accent-dark); }
.button.primary:hover { background: #ad2b14; }
.button.secondary { color: var(--ink); background: transparent; border-color: #a5aaa5; }
.button.secondary:hover { border-color: var(--ink); background: rgba(255,255,255,0.42); }
.button.full { width: 100%; }
.panel { background: var(--panel); border: 1px solid var(--line); box-shadow: var(--shadow); }

.document { max-width: 790px; margin: 0 auto; padding: clamp(26px, 5vw, 70px); background: var(--panel); border-top: 6px solid var(--accent); box-shadow: var(--shadow); }
.document h1 { font-size: clamp(38px, 5vw, 61px); }
.document h2 { margin-top: 38px; }
.document p { color: #49554f; font-size: 17px; line-height: 1.75; }

.auth-layout { display: grid; grid-template-columns: 1.2fr minmax(320px, 0.7fr); gap: 80px; align-items: center; padding: 7vh 0; }
.auth-intro p:last-child { max-width: 600px; color: var(--muted); font-size: 19px; line-height: 1.6; }
.auth-form { padding: 34px; border-top: 6px solid var(--accent); }
.auth-form label, .editor-form label { display: block; margin: 0 0 8px; font-weight: 760; }
.auth-form input, .editor-form input[type="text"], .editor-form input[type="url"], .editor-form textarea, .filter-bar input, .filter-bar select {
    width: 100%; min-height: 46px; margin: 0 0 20px; padding: 11px 13px; color: var(--ink); background: #fff; border: 1px solid #b9bdb8; border-radius: 2px; outline: none;
}
.auth-form input:focus, .editor-form input:focus, .editor-form textarea:focus, .filter-bar input:focus, .filter-bar select:focus { border-color: var(--accent-dark); box-shadow: 0 0 0 3px rgba(207,58,29,.12); }
.form-errors, .field-error { display: block; margin: -8px 0 16px; color: var(--danger); font-size: 14px; }

.page-heading { display: flex; align-items: end; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.page-heading h1 { font-size: clamp(38px, 5vw, 60px); }
.page-heading p:not(.eyebrow) { max-width: 680px; margin-bottom: 0; color: var(--muted); }
.page-heading.compact { max-width: 760px; }
.metric-strip { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); margin: 0 0 22px; color: #f5f3e9; background: var(--deep); }
.metric-strip.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.metric-strip div { min-height: 112px; display: flex; flex-direction: column; justify-content: space-between; padding: 22px 25px; border-right: 1px solid #365149; }
.metric-strip div:last-child { border: 0; }
.metric-strip span { color: #aebdb7; font-size: 13px; }
.metric-strip strong { color: var(--accent); font: 700 38px/1 Georgia, serif; }
.metric-strip .metric-date { color: #f5f3e9; font: 700 22px/1.2 Inter, sans-serif; }

.filter-bar { display: grid; grid-template-columns: minmax(220px, 1fr) 190px auto; gap: 12px; align-items: end; padding: 17px; margin-bottom: 22px; background: rgba(255,254,249,.72); border: 1px solid var(--line); }
.filter-bar input, .filter-bar select { margin: 0; }
.date-filter { grid-template-columns: 190px 190px auto; justify-content: start; }
.date-filter label { color: var(--muted); font-size: 12px; font-weight: 700; }
.date-filter label input { margin-top: 6px; }
.table-panel { overflow: hidden; }
.table-scroll { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { padding: 14px 18px; color: var(--muted); background: #ebeae3; border-bottom: 1px solid var(--line); text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; white-space: nowrap; }
td { padding: 18px; border-bottom: 1px solid #e8e6de; vertical-align: top; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fffaf0; }
.number { text-align: right; }
.strong { font-weight: 820; }
.table-title { display: block; margin-bottom: 6px; color: var(--ink); font-weight: 800; text-decoration: none; }
.table-title:hover { color: var(--accent-dark); }
.table-subtitle { display: block; max-width: 620px; color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.status { display: inline-block; padding: 5px 9px; border-radius: 20px; font-size: 12px; font-weight: 780; }
.status.active { color: #235532; background: var(--mint); }
.status.inactive { color: #76483d; background: #efddd8; }
.empty-state { padding: 60px 24px; text-align: center; }
.empty-state h2 { margin: 0 0 8px; }
.empty-state p { color: var(--muted); }

.editor-form { max-width: 780px; padding: clamp(24px, 4vw, 44px); border-top: 6px solid var(--accent); }
.form-row { margin-bottom: 22px; }
.form-row textarea { resize: vertical; }
.checkbox-row { display: flex; align-items: center; gap: 10px; }
.checkbox-row label { margin: 0; }
.checkbox-row input { width: 18px; height: 18px; accent-color: var(--accent-dark); }
.form-actions { display: flex; flex-wrap: wrap; gap: 10px; padding-top: 8px; }

.detail-heading h1 { margin-top: 10px; }
.back-link { color: var(--accent-dark); font-size: 13px; font-weight: 750; text-decoration: none; }
.link-card { display: grid; grid-template-columns: 1fr auto; gap: 20px; align-items: center; margin-bottom: 22px; padding: 24px; border-left: 6px solid var(--accent); }
.link-card code { display: block; overflow-wrap: anywhere; margin-top: 7px; font-size: 14px; }
.label { color: var(--muted); font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.copy-button { padding: 8px 12px; color: var(--accent-dark); background: transparent; border: 1px solid #c9b9b2; cursor: pointer; }
.link-target { grid-column: 1 / -1; padding-top: 18px; border-top: 1px solid var(--line); }
.link-target a { display: block; overflow-wrap: anywhere; margin-top: 7px; color: #35564c; }
.country-code, .bot-tag { display: inline-block; margin-right: 5px; padding: 2px 5px; color: #40514a; background: #e0e5e0; border-radius: 2px; font-size: 10px; font-weight: 850; }
.bot-tag { margin: 0 0 0 5px; color: #714231; background: #f1d9cf; }
.event-section { margin: 42px 0 58px; }
.section-title-row { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 18px; }
.section-title-row h2 { margin: 0; font-size: clamp(28px, 4vw, 40px); }
.section-title-row > strong { color: var(--accent-dark); font: 700 42px/1 Georgia, serif; }
.aggregate-title { margin-top: 50px; }
.event-list { display: grid; gap: 14px; }
.event-card { display: grid; grid-template-columns: 130px minmax(0, 1fr); overflow: hidden; }
.event-time { display: flex; flex-direction: column; justify-content: center; padding: 22px; color: #f5f3e9; background: var(--deep); }
.event-time span { color: #afbeb8; font-size: 13px; }
.event-time strong { margin: 7px 0; color: var(--accent); font: 700 25px/1 Georgia, serif; }
.event-time small { color: #7f968e; }
.event-data { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); margin: 0; }
.event-data div { min-width: 0; padding: 17px 19px; border-right: 1px solid #ebe8df; border-bottom: 1px solid #ebe8df; }
.event-data div:nth-child(4n) { border-right: 0; }
.event-data div:nth-last-child(-n+4) { border-bottom: 0; }
.event-data dt { margin-bottom: 6px; color: var(--muted); font-size: 10px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.event-data dd { overflow-wrap: anywhere; margin: 0; font-size: 13px; font-weight: 680; }
.event-data code { font-size: 12px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 18px; margin-top: 20px; }
.pagination a { padding: 8px 12px; color: var(--accent-dark); border: 1px solid #c9b9b2; text-decoration: none; }
.pagination span { color: var(--muted); font-size: 13px; }

.messages { margin-bottom: 22px; }
.message { padding: 13px 16px; color: #245331; background: var(--mint); border-left: 4px solid #39804e; }
.error-page { min-height: 55vh; display: flex; flex-direction: column; align-items: flex-start; justify-content: center; }
.error-page > span { color: var(--accent); font: 700 clamp(80px, 16vw, 180px)/.75 Georgia, serif; }
.error-page h1 { margin-top: 28px; font-size: clamp(38px, 6vw, 66px); }
.error-page p { color: var(--muted); font-size: 18px; }
.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; }

@media (max-width: 760px) {
    .topbar { min-height: 64px; padding: 10px 18px; }
    .brand > span:last-child { display: none; }
    .topnav { gap: 14px; }
    .page-shell { width: min(100% - 28px, 1180px); padding: 34px 0 52px; }
    .landing-grid, .auth-layout { grid-template-columns: 1fr; gap: 40px; }
    .landing-grid { padding-top: 1vh; }
    .page-heading { align-items: flex-start; flex-direction: column; }
    .metric-strip.three { grid-template-columns: 1fr; }
    .metric-strip.three div { min-height: 86px; border-right: 0; border-bottom: 1px solid #365149; }
    .filter-bar, .date-filter { grid-template-columns: 1fr; }
    .filter-bar .button { width: 100%; }
    .link-card { grid-template-columns: 1fr; }
    .link-target { grid-column: 1; }
    .copy-button { justify-self: start; }
    .event-card { grid-template-columns: 1fr; }
    .event-time { flex-direction: row; align-items: baseline; justify-content: flex-start; gap: 10px; }
    .event-time strong { margin: 0; }
    .event-data { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .event-data div:nth-child(4n) { border-right: 1px solid #ebe8df; }
    .event-data div:nth-child(2n) { border-right: 0; }
    .event-data div:nth-last-child(-n+4) { border-bottom: 1px solid #ebe8df; }
    .event-data div:nth-last-child(-n+2) { border-bottom: 0; }
    .footer { flex-direction: column; }
}
