/* TAEON HUB — admin */
:root {
    --paper: #F7F7F2;
    --paper-pure: #FFFFFF;
    --ink: #0E0E10;
    --ink-2: #1F1F23;
    --mute: #6B6B70;
    --line: #E5E5DF;
    --line-2: #ECECE6;
    --accent: #C8102E;
    --accent-soft: #FCEEEF;
    --green: #0a6b2e;
    --r-sm: 6px;
    --r-md: 10px;
    --shadow-sm: 0 1px 2px rgba(14,14,16,0.06);
    --shadow-md: 0 8px 24px -8px rgba(14,14,16,0.18);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Apple SD Gothic Neo", sans-serif;
    color: var(--ink);
    background: var(--paper);
    font-size: 14px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); }
h1, h2, h3, h4 { margin: 0; font-weight: 800; letter-spacing: -0.015em; }
h1 { font-size: 28px; }
h2 { font-size: 18px; }
small { color: var(--mute); }

/* ============ LOGIN ============ */
.login-body {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.login-card {
    width: 100%; max-width: 420px;
    background: var(--paper-pure);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    box-shadow: var(--shadow-md);
    padding: 36px 32px;
}
.login-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 28px; }
.login-mark {
    width: 44px; height: 44px;
    background: var(--ink); color: var(--paper-pure);
    border-radius: var(--r-sm);
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 16px; letter-spacing: 0.04em;
}
.login-name { font-weight: 800; font-size: 18px; }
.login-tag { font-size: 12px; color: var(--mute); margin-top: 2px; }
.login-form { display: flex; flex-direction: column; gap: 14px; }

/* ============ FIELDS ============ */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 12px; font-weight: 600; color: var(--mute); letter-spacing: 0.04em; text-transform: uppercase; }
.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="url"],
.field input[type="number"],
.field input[type="date"],
.field input[type="datetime-local"],
.field select,
.field textarea,
input.input, select.input, textarea.input {
    background: var(--paper-pure);
    border: 1px solid var(--line);
    border-radius: var(--r-sm);
    padding: 10px 12px;
    font: inherit;
    color: var(--ink);
    transition: border-color 0.15s;
    width: 100%;
}
.field textarea { min-height: 80px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus,
input.input:focus, select.input:focus, textarea.input:focus {
    outline: 0;
    border-color: var(--ink);
}
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .field-row { grid-template-columns: 1fr; } }

/* ============ BUTTONS ============ */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: var(--r-sm);
    border: 1px solid var(--line);
    background: var(--paper-pure);
    color: var(--ink);
    font: inherit; font-weight: 600;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, transform 0.1s;
    text-decoration: none;
}
.btn:hover { border-color: var(--ink); }
.btn-primary { background: var(--ink); color: var(--paper-pure); border-color: var(--ink); }
.btn-primary:hover { background: #000; color: var(--paper-pure); transform: translateY(-1px); }
.btn-danger { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-danger:hover { background: #a40d24; color: #fff; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 10px; font-size: 12px; }
.btn-block { width: 100%; }

/* ============ APP LAYOUT ============ */
.app { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }

/* mobile chrome — hidden on desktop, activated under 900px */
.topbar { display: none; }
.burger { display: none; }
.nav-scrim { display: none; }

.sidebar {
    background: var(--ink);
    color: #fff;
    padding: 22px 16px 16px;
    display: flex; flex-direction: column;
    min-height: 100vh;
    position: sticky; top: 0;
}
/* ============ MOBILE DRAWER (≤900px) ============ */
@media (max-width: 900px) {
    .app { grid-template-columns: 1fr; }

    .topbar {
        display: flex; align-items: center; gap: 10px;
        position: sticky; top: 0; z-index: 50;
        background: var(--ink); color: #fff;
        padding: 10px 14px;
        box-shadow: var(--shadow-sm);
    }
    .topbar-brand { display: flex; align-items: center; gap: 9px; color: #fff; font-weight: 800; font-size: 14px; min-width: 0; }
    .topbar-brand span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .topbar-brand:hover { color: #fff; }

    .burger {
        display: inline-flex; flex-direction: column; justify-content: center; gap: 5px;
        width: 40px; height: 40px; flex: 0 0 auto;
        background: transparent; border: 0; cursor: pointer; padding: 9px;
        border-radius: 6px;
    }
    .burger span { display: block; height: 2px; background: #fff; border-radius: 2px; transition: transform 0.2s, opacity 0.2s; }
    body.nav-open .burger span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    body.nav-open .burger span:nth-child(2) { opacity: 0; }
    body.nav-open .burger span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

    .sidebar {
        position: fixed; top: 0; left: 0; bottom: 0;
        width: 264px; max-width: 82vw;
        z-index: 70; min-height: 100vh;
        transform: translateX(-100%);
        transition: transform 0.24s cubic-bezier(0.4, 0, 0.2, 1);
        overflow-y: auto;
    }
    body.nav-open .sidebar { transform: translateX(0); box-shadow: 0 0 60px rgba(0,0,0,0.45); }

    .nav-scrim {
        display: block; position: fixed; inset: 0; z-index: 60;
        background: rgba(0,0,0,0.45);
        opacity: 0; transition: opacity 0.24s;
    }
    .nav-scrim[hidden] { display: block; opacity: 0; pointer-events: none; }
    body.nav-open .nav-scrim { opacity: 1; }
    body.nav-open { overflow: hidden; }
}

.brand { display: flex; align-items: center; gap: 10px; color: #fff; margin-bottom: 28px; padding: 0 4px; }
.brand:hover { color: #fff; }
.brand-mark {
    width: 32px; height: 32px;
    background: var(--paper-pure); color: var(--ink);
    border-radius: 6px;
    display: flex; align-items: center; justify-content: center;
    font-weight: 800; font-size: 12px; letter-spacing: 0.04em;
}
.brand-name { font-weight: 800; font-size: 15px; }

.nav { display: flex; flex-direction: column; gap: 2px; flex: 1 1 auto; }
.nav-section {
    font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
    color: rgba(255,255,255,0.4);
    padding: 18px 8px 6px;
    font-weight: 700;
}
.nav-link {
    display: flex; align-items: center; gap: 10px;
    padding: 9px 10px;
    color: rgba(255,255,255,0.78);
    font-weight: 600;
    border-radius: 6px;
    font-size: 13.5px;
    transition: background 0.12s, color 0.12s;
}
.nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; }
.nav-link.is-active { background: rgba(255,255,255,0.12); color: #fff; }
.nav-ico { width: 18px; text-align: center; opacity: 0.85; }

.sidebar-foot {
    margin-top: auto;
    padding-top: 18px;
    border-top: 1px solid rgba(255,255,255,0.08);
    display: flex; align-items: center; gap: 12px;
}
.me { flex: 1 1 auto; min-width: 0; }
.me-name { color: #fff; font-weight: 700; font-size: 13px; }
.me-role { color: rgba(255,255,255,0.5); font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; }
.me-logout { font-size: 12px; color: rgba(255,255,255,0.6); }
.me-logout:hover { color: #fff; }

.main { padding: 28px 32px 56px; min-width: 0; }
@media (max-width: 640px) { .main { padding: 20px 16px; } }

/* ============ PAGE HEAD ============ */
.pagehead {
    display: flex; align-items: flex-end; justify-content: space-between;
    gap: 16px; flex-wrap: wrap;
    margin-bottom: 20px;
}
.eyebrow {
    font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase;
    color: var(--mute); font-weight: 700;
}

/* ============ ALERTS ============ */
.alert {
    padding: 10px 14px;
    border-radius: var(--r-sm);
    margin-bottom: 16px;
    font-size: 13.5px;
    border: 1px solid;
}
.alert-info    { background: #E8F0FA; border-color: #C6DAF0; color: #1a3a6e; }
.alert-success { background: #DEF5E5; border-color: #B7E2C2; color: #1a5d2e; }
.alert-error   { background: #FCEEEF; border-color: #F3C9CE; color: #8a1224; }
.alert-warn    { background: #FFF4D6; border-color: #F5D78A; color: #6e4a00; }

/* ============ CARDS / TABLES ============ */
.card {
    background: var(--paper-pure);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    margin-bottom: 22px;
    overflow: hidden;
}
.card-head {
    display: flex; align-items: center; justify-content: space-between;
    gap: 12px; flex-wrap: wrap;
    padding: 16px 20px;
    border-bottom: 1px solid var(--line);
}
.card-body { padding: 20px; }
.link { font-size: 13px; color: var(--mute); font-weight: 600; }
.link:hover { color: var(--ink); }

.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 12px 20px; text-align: left; border-top: 1px solid var(--line-2); }
.table th { font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--mute); font-weight: 700; background: var(--paper); border-top: 0; }
.table tbody tr:hover { background: var(--paper); }
.table tbody tr:first-child td { border-top: 0; }

.badge {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 9999px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.02em;
}

.empty { padding: 30px; text-align: center; color: var(--mute); }

/* ============ STAT GRID ============ */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}
.stat {
    background: var(--paper-pure);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    padding: 18px 20px;
    display: flex; flex-direction: column; gap: 6px;
    transition: border-color 0.15s, transform 0.15s;
}
.stat:hover { border-color: var(--ink); transform: translateY(-1px); }
.stat-label { font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--mute); font-weight: 700; }
.stat-num { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ============ FORMS ============ */
.form-grid { display: grid; gap: 14px; max-width: 720px; }
.actions-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 8px; }

/* ============ DETAIL GRID (project/campaign view) ============ */
.detail-grid {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
    gap: 20px;
}
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.panel-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--mute); }
.kv dd { margin: 0; }

/* ============ RESPONSIVE TABLES ============ */
/* the card becomes the horizontal scroll container; the table keeps real
   table layout (no display:block) and gets a min-width so it scrolls
   sideways on narrow screens instead of squashing columns. */
@media (max-width: 720px) {
    .card { overflow-x: auto; -webkit-overflow-scrolling: touch; }
    .card > .table { min-width: 560px; white-space: nowrap; }
    .table th, .table td { padding: 11px 14px; }
}

/* ============ MOBILE TYPE / SPACING ============ */
@media (max-width: 640px) {
    h1 { font-size: 22px; }
    h2 { font-size: 16px; }
    .stat { padding: 14px 16px; }
    .stat-num { font-size: 26px; }
    .stat-grid { gap: 10px; margin-bottom: 18px; }
    .pagehead { margin-bottom: 16px; }
    .card-head { padding: 14px 16px; }
    .card-body { padding: 16px; }
    .btn { padding: 10px 16px; }   /* larger touch target */
    .btn-sm { padding: 7px 11px; }
}
