:root {
    --ink: #17211b;
    --muted: #68736c;
    --paper: #f5f3ed;
    --panel: #fffefa;
    --line: #deddd5;
    --green: #196c4b;
    --green-dark: #105039;
    --mint: #dcece3;
    --amber: #d6973e;
    --danger: #a83b36;
    --shadow: 0 18px 45px rgba(39, 49, 41, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--green); }
button, input { font: inherit; }

.topbar { height: 72px; padding: 0 max(24px, calc((100vw - 1180px) / 2)); display: flex; align-items: center; justify-content: space-between; background: rgba(245,243,237,.94); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; backdrop-filter: blur(12px); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 800; text-decoration: none; letter-spacing: -.02em; }
.topbar nav { display: flex; gap: 22px; }
.topbar nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 650; }
.brand-mark { width: 52px; height: 52px; display: grid; place-items: center; background: var(--green); color: white; border-radius: 15px; font-size: 18px; font-weight: 850; box-shadow: 0 8px 20px rgba(25,108,75,.22); }
.brand-mark.small { width: 34px; height: 34px; border-radius: 10px; font-size: 12px; }

.page-shell { width: min(1180px, calc(100% - 40px)); margin: 0 auto; padding: 68px 0 40px; }
.hero { display: grid; grid-template-columns: 1fr auto; align-items: end; gap: 40px; margin-bottom: 48px; }
.hero h1 { max-width: 720px; margin: 4px 0 14px; font-family: Georgia, "Times New Roman", serif; font-size: clamp(42px, 6vw, 72px); line-height: .98; letter-spacing: -.045em; font-weight: 500; }
.hero p:not(.eyebrow) { color: var(--muted); font-size: 18px; max-width: 680px; line-height: 1.6; }
.eyebrow { margin: 0 0 8px; color: var(--green); text-transform: uppercase; letter-spacing: .14em; font-size: 12px; font-weight: 850; }
.stats { display: flex; background: var(--ink); color: white; border-radius: 18px; padding: 18px 12px; box-shadow: var(--shadow); }
.stats div { min-width: 100px; text-align: center; padding: 4px 18px; }
.stats div + div { border-left: 1px solid rgba(255,255,255,.18); }
.stats strong, .stats span { display: block; }
.stats strong { font-family: Georgia, serif; font-size: 30px; }
.stats span { margin-top: 2px; color: #bec9c2; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; }

.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 22px; box-shadow: var(--shadow); }
.create-panel { padding: 30px; margin-bottom: 48px; border-top: 4px solid var(--amber); }
.section-heading { display: flex; justify-content: space-between; gap: 30px; align-items: end; margin-bottom: 24px; }
.section-heading h2 { margin: 0; font-family: Georgia, serif; font-size: 31px; font-weight: 500; letter-spacing: -.02em; }
.section-heading > p { margin: 0; color: var(--muted); font-size: 14px; }
.create-grid { display: grid; grid-template-columns: 1fr 1fr 1.25fr auto; gap: 14px; align-items: end; }
label { display: block; font-size: 13px; font-weight: 750; color: #3d4941; }
label span { color: var(--muted); font-weight: 500; }
input { width: 100%; margin-top: 8px; height: 46px; border: 1px solid #d3d5ce; border-radius: 10px; padding: 0 13px; background: white; color: var(--ink); outline: none; transition: border .2s, box-shadow .2s; }
input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(25,108,75,.1); }
.button { min-height: 44px; border: 0; border-radius: 10px; padding: 0 18px; cursor: pointer; font-weight: 750; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.button.primary { background: var(--green); color: white; box-shadow: 0 7px 16px rgba(25,108,75,.18); }
.button.primary:hover { background: var(--green-dark); }
.button.ghost { background: var(--mint); color: var(--green-dark); }
.full-button { width: 100%; margin-top: 10px; }

.trackers-section > .section-heading { margin-bottom: 18px; }
.tracker-card { margin-bottom: 20px; overflow: hidden; }
.tracker-header { display: flex; justify-content: space-between; align-items: center; padding: 23px 26px; border-bottom: 1px solid var(--line); }
.tracker-header h3 { margin: 0 0 5px; font-size: 19px; }
.tracker-header p { margin: 0; color: var(--muted); font-size: 13px; }
.event-count { background: #edf0ec; border-radius: 100px; padding: 7px 11px; font-size: 12px; font-weight: 800; }
.url-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 17px; padding: 24px 26px; background: #fbfaf5; border-bottom: 1px solid var(--line); }
.url-grid .full { grid-column: 1 / -1; }
.copy-row { display: flex; gap: 8px; }
.copy-row input { min-width: 0; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 12px; }
.copy-row .button { margin-top: 8px; }
.event-table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 12px 16px; text-align: left; background: #f3f2ed; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .07em; }
td { padding: 14px 16px; border-top: 1px solid #e9e8e2; vertical-align: middle; white-space: nowrap; }
td.ua { max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.empty-cell { padding: 28px; text-align: center; color: var(--muted); }
.event-type { display: inline-block; padding: 5px 8px; border-radius: 6px; color: #78511f; background: #f8e9d2; font-size: 11px; font-weight: 800; }
.event-type.location { color: var(--green-dark); background: var(--mint); }
.tracker-actions { display: flex; justify-content: flex-end; gap: 15px; padding: 12px 20px; border-top: 1px solid var(--line); }
.text-button { border: 0; background: none; color: var(--muted); font-size: 12px; cursor: pointer; }
.text-button.danger { color: var(--danger); }

.empty-state { padding: 50px; text-align: center; background: rgba(255,255,255,.5); border: 1px dashed #c8c9c1; border-radius: 18px; margin-bottom: 30px; }
.empty-state h3 { margin: 0 0 8px; }
.empty-state p { margin: 0; color: var(--muted); }
.instructions { padding: 34px; margin-top: 50px; }
.instructions h2 { margin: 0 0 22px; font-family: Georgia, serif; font-size: 32px; font-weight: 500; }
.instructions ol { padding-left: 22px; color: #3f4b44; line-height: 1.7; }
.instructions li { margin: 10px 0; padding-left: 6px; }
.note { margin-top: 22px; padding: 17px 19px; background: #f7ebda; border-left: 4px solid var(--amber); border-radius: 8px; color: #594a36; line-height: 1.55; font-size: 14px; }
.site-footer { padding: 24px 20px 40px; text-align: center; color: var(--muted); font-size: 12px; }
.alert { margin: -20px 0 28px; padding: 14px 17px; border-radius: 10px; font-size: 14px; }
.alert.error { color: #762c28; background: #f9dfdc; border: 1px solid #efc2bd; }
.alert.success { color: var(--green-dark); background: var(--mint); border: 1px solid #c6dfd1; }

.auth-body { min-height: 100vh; display: grid; place-items: center; padding: 28px; background: radial-gradient(circle at 15% 10%, #dce9df 0, transparent 36%), radial-gradient(circle at 90% 90%, #f3dfc0 0, transparent 32%), var(--paper); }
.auth-card { width: min(460px, 100%); padding: 40px; background: rgba(255,254,250,.94); border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); }
.auth-card .brand-mark { margin-bottom: 30px; }
.auth-card h1 { margin: 0 0 13px; font-family: Georgia, serif; font-size: 38px; line-height: 1.08; font-weight: 500; letter-spacing: -.025em; }
.muted { color: var(--muted); line-height: 1.6; }
.stack-form { display: grid; gap: 17px; margin-top: 28px; }
.stack-form .button { margin-top: 5px; }
.auth-card .alert { margin: 20px 0 0; }
.consent-card { text-align: left; }
.consent-card .privacy-copy { padding: 14px; border-radius: 10px; background: #edf0ec; color: #4c574f; font-size: 13px; line-height: 1.55; }
.status-box { margin: 20px 0 12px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 9px; color: var(--muted); font-size: 13px; }
.consent-card > .button { width: 100%; }

@media (max-width: 900px) {
    .create-grid { grid-template-columns: 1fr 1fr; }
    .create-grid label:nth-of-type(3) { grid-column: 1 / -1; }
    .hero { grid-template-columns: 1fr; }
    .stats { width: max-content; }
}
@media (max-width: 620px) {
    .page-shell { width: min(100% - 24px, 1180px); padding-top: 40px; }
    .topbar { padding: 0 14px; }
    .topbar nav a:first-child { display: none; }
    .hero h1 { font-size: 43px; }
    .create-grid, .url-grid { grid-template-columns: 1fr; }
    .create-grid label:nth-of-type(3), .url-grid .full { grid-column: auto; }
    .create-panel, .instructions { padding: 22px; }
    .tracker-header { align-items: flex-start; gap: 12px; }
    .url-grid { padding: 20px; }
    .copy-row { align-items: stretch; }
    .copy-row .button { padding: 0 12px; }
    .auth-card { padding: 28px; }
}

