:root {
    --ink: #321E37;
    --ink-strong: #2C1F53;
    --bg: #F8F5F0;
    --card: #FEFFFB;
    --lime: #A6D139;
    --wine: #534265;
    --border: #E8E4EC;
    --peach: #FBEDCF;
    --lilac: #DDE2FE;
    --mint: #DFFECE;
    --muted: #8B8295;
}

* { box-sizing: border-box; }

body {
    font-family: 'Lato', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--ink);
    margin: 0;
}

a { color: inherit; }

/* Topbar */
.topbar {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    background: #fff;
    padding: .85rem 1.75rem;
    box-shadow: 0 8px 20px 0 rgba(44, 32, 83, .04);
    position: sticky;
    top: 0;
    z-index: 10;
}

.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; font-weight: 700; font-size: 18px; color: var(--ink); }
.brand img { width: 30px; height: 30px; }

.nav { display: flex; gap: .35rem; margin-left: .5rem; }
.nav a { text-decoration: none; color: var(--wine); font-weight: 700; font-size: 14px; padding: .45rem .8rem; border-radius: 8px; }
.nav a:hover { background: var(--bg); }
.nav a.active { color: var(--ink); background: var(--mint); }

.topbar-user { margin-left: auto; display: flex; align-items: center; gap: 1rem; }
.topbar-email { color: var(--wine); font-size: 14px; }

/* Layout */
.container { max-width: 1440px; margin: 0 auto; padding: 2rem 1.75rem 3rem; }

/* Typography */
h1 { font-weight: 1000; font-size: 32px; margin: 0 0 .35rem; }
h2 { font-weight: 700; font-size: 18px; margin: 2rem 0 .9rem; }
.lede { color: var(--wine); font-size: 16px; margin: 0 0 1.5rem; }
.muted { color: var(--wine); }
.footnote { color: var(--muted); font-size: 13px; margin-top: 2rem; }

/* Buttons */
.btn {
    display: inline-block;
    background: var(--ink);
    color: #fff;
    font-family: inherit;
    font-weight: 700;
    font-size: 14px;
    padding: .55rem 1.1rem;
    border: 0;
    border-radius: 9px;
    text-decoration: none;
    cursor: pointer;
    transition: background .15s;
}
.btn:hover { background: var(--ink-strong); }
.btn-ghost { background: transparent; color: var(--wine); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--bg); }

/* Cards */
.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    box-shadow: 0 12px 36px 0 rgba(44, 32, 83, .05);
    padding: 1.5rem;
}

/* Stat grid */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin: 1.25rem 0; }
.stat {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 1.1rem 1.25rem;
    box-shadow: 0 8px 20px 0 rgba(44, 32, 83, .04);
}
.stat .label { text-transform: uppercase; letter-spacing: .5px; font-size: 11px; font-weight: 700; color: var(--muted); margin: 0 0 .35rem; }
.stat .value { font-size: 26px; font-weight: 700; color: var(--ink); }
.stat .sub { font-size: 13px; color: var(--wine); margin-top: .2rem; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: .6rem .7rem; border-bottom: 1px solid var(--border); }
th { text-transform: uppercase; letter-spacing: .4px; font-size: 11px; color: var(--muted); }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr:last-child td { border-bottom: 0; }

/* Badges & pills */
.badge { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px; padding: .12rem .5rem; border-radius: 6px; background: var(--lilac); color: var(--ink-strong); }
.badge.sub { background: var(--mint); }
.pill-green { color: #3d6a14; font-weight: 700; }

/* Filter form */
form.filter { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; margin: 0 0 1.25rem; }
form.filter input,
form.filter select { font-family: inherit; font-size: 14px; padding: .5rem .7rem; border: 1px solid var(--border); border-radius: 9px; color: var(--ink); background: #fff; }
form.filter label { font-size: 13px; color: var(--wine); font-weight: 700; }

/* Alerts */
.alert { border-radius: 12px; padding: 1rem 1.15rem; margin: 1rem 0; font-size: 14px; }
.alert-error { background: #FDECEA; color: #8A1C1C; border: 1px solid #F5C6C0; }
.alert-info { background: var(--peach); color: var(--ink); border: 1px solid #F0DCA8; }

/* Tool list */
.tool-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; margin-top: 1rem; }
.tool-card { display: block; text-decoration: none; }
.tool-card .card { height: 100%; transition: border-color .15s, box-shadow .15s; }
.tool-card:hover .card { border-color: var(--lime); box-shadow: 0 12px 36px 0 rgba(44, 32, 83, .08); }
.tool-card h3 { margin: .2rem 0 .35rem; font-size: 17px; }

/* Tooltips */
[data-tooltip] { position: relative; cursor: help; border-bottom: 1px dotted var(--muted); }
[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 6px);
    right: 0;
    background: var(--ink-strong);
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    text-transform: none;
    letter-spacing: 0;
    padding: .45rem .65rem;
    border-radius: 8px;
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s;
    z-index: 100;
}
[data-tooltip]:hover::after { opacity: 1; }

/* Chips (kept for backwards compat, not used in new templates) */
.chips { display: flex; flex-wrap: wrap; gap: .4rem; margin: .4rem 0 .6rem; }
.chip { background: var(--bg); border-radius: 999px; padding: .2rem .7rem; font-size: 12.5px; color: var(--wine); }
.chip b { color: var(--ink); }
