* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg-app); color: var(--fg); font-family: var(--font-sans); }
a { color: var(--brand-press); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: var(--font-sans); cursor: pointer; }

.app-shell { display: flex; min-height: 100vh; }

.sidebar {
    width: 256px; flex-shrink: 0; background: var(--bg-surface);
    border-right: 1px solid var(--border-subtle); display: flex; flex-direction: column;
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.sidebar-logo { padding: 22px 20px 14px; }
.sidebar-logo img { width: 150px; height: auto; display: block; }
.sidebar-section { padding: 0 14px 6px; }
.sidebar-eyebrow { padding: 12px 12px 6px; }
.campaign-select, .field-select {
    width: 100%; appearance: none; font-family: var(--font-sans); font-size: 13.5px; font-weight: 600;
    color: var(--fg-strong); padding: 9px 12px; border-radius: 10px; border: 1px solid var(--border);
    background: var(--bg-surface); cursor: pointer;
}
.nav { display: flex; flex-direction: column; gap: 3px; margin-top: 8px; }
.nav-item {
    display: flex; align-items: center; gap: 10px; width: 100%; text-align: left;
    padding: 9px 12px; border-radius: 10px; border: 1px solid transparent; background: transparent;
    color: var(--fg-muted); font-size: 14px; font-weight: 500; transition: all .15s var(--ease-out);
}
.nav-item:hover { background: var(--stone-100); text-decoration: none; }
.nav-item.active { background: var(--brand-tint); color: var(--brand-press); font-weight: 600; }
.sidebar-foot { margin-top: auto; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.user-card { padding: 12px 14px; border-radius: 12px; background: var(--bg-warm); border: 1px solid var(--sand-100); }
.user-card .name { font-size: 13px; font-weight: 600; color: var(--sand-600); }
.user-card .role { font-size: 11.5px; color: var(--fg-muted); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.header {
    position: sticky; top: 0; z-index: 20; background: rgba(250,247,244,0.86); backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--border-subtle); padding: 18px 32px;
    display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; flex-wrap: wrap;
}
.content { padding: 26px 32px 80px; flex: 1; }
.muted { color: var(--fg-muted); }

.btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px;
    border-radius: 9px; border: 1px solid var(--border); background: var(--bg-surface); color: var(--fg-strong);
    font-size: 13.5px; font-weight: 600;
}
.btn:hover { background: var(--bg-sunken); text-decoration: none; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
button:disabled, .btn:disabled, .pill:disabled, select:disabled, .field-select:disabled, .campaign-select:disabled {
    opacity: 0.55; cursor: not-allowed; pointer-events: none;
}

.card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 16px; padding: 22px; box-shadow: var(--shadow-xs); }
.grid-weeks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.grid-cards { display: grid; gap: 16px; }

.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap; }
.platform-badge { width: 26px; height: 26px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; flex-shrink: 0; }
.dot { width: 9px; height: 9px; border-radius: 999px; display: inline-block; }

.cal-week { margin-bottom: 22px; }
.cal-week-head { display: flex; align-items: baseline; gap: 12px; margin-bottom: 10px; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 10px; }
.cal-day { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 10px; min-height: 116px; display: flex; flex-direction: column; gap: 7px; }
.cal-day-num { font-size: 12px; font-weight: 700; color: var(--fg-strong); }
.post-chip { width: 100%; text-align: left; display: flex; align-items: center; gap: 8px; padding: 7px 8px; border-radius: 9px; background: var(--bg-surface); border: 1px solid var(--border-subtle); box-shadow: var(--shadow-xs); }
.post-chip:hover { box-shadow: var(--shadow-sm); }
.post-chip .topic { flex: 1; min-width: 0; font-size: 12.5px; font-weight: 500; color: var(--fg-strong); line-height: 1.25; overflow: hidden; }

.filter-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pill-group { display: inline-flex; gap: 4px; padding: 4px; border-radius: 12px; background: var(--bg-sunken); border: 1px solid var(--border-subtle); }
.pill { padding: 6px 12px; border-radius: 9px; border: none; background: transparent; color: var(--fg-muted); font-size: 13px; font-weight: 600; }
.pill.active { background: var(--bg-surface); color: var(--fg-strong); box-shadow: var(--shadow-xs); }
.pill-icon { padding: 4px; line-height: 0; display: inline-flex; }
.pill-icon.dim { opacity: 0.5; }
.pill-icon:hover { opacity: 1; }

.table { width: 100%; border-collapse: collapse; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 16px; overflow: hidden; }
.table thead th { text-align: left; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--fg-subtle); font-weight: 700; padding: 12px 16px; background: var(--bg-sunken); border-bottom: 1px solid var(--border-subtle); }
.table tbody td { padding: 12px 16px; border-bottom: 1px solid var(--border-subtle); font-size: 13.5px; vertical-align: middle; }
.table tbody tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: var(--bg-sunken); cursor: pointer; }

.drawer-scrim { position: fixed; inset: 0; background: var(--bg-overlay); z-index: 60; }
.drawer { position: fixed; top: 0; right: 0; height: 100%; width: min(560px, 94vw); background: var(--bg-surface); box-shadow: var(--shadow-xl); z-index: 61; display: flex; flex-direction: column; }
.drawer-head { padding: 18px 24px; border-bottom: 1px solid var(--border-subtle); display: flex; align-items: center; gap: 14px; }
.drawer-body { overflow-y: auto; padding: 20px 24px 40px; }
.field-block { border-top: 1px solid var(--border-subtle); padding: 16px 0; }
.field-block:first-child { border-top: none; }
.field-label { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--brand); font-weight: 700; margin-bottom: 8px; }
.field-body { white-space: pre-wrap; font-size: 14px; line-height: 1.6; color: var(--fg); }

.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.status-toggle { display: inline-flex; gap: 4px; padding: 4px; border-radius: 10px; background: var(--bg-sunken); border: 1px solid var(--border-subtle); }
.status-toggle button { padding: 5px 10px; border-radius: 7px; border: none; background: transparent; color: var(--fg-muted); font-size: 12.5px; font-weight: 600; }
.status-toggle button.active { background: var(--brand); color: #fff; }

.tag-edit { display: flex; flex-direction: column; gap: 10px; }
.tag-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 600; color: var(--fg-muted); }
.tag-chips { display: flex; gap: 8px; flex-wrap: wrap; }

.login-shell { max-width: 380px; margin: 12vh auto; padding: 36px 34px; background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px; }
.login-logo { height: 30px; width: auto; align-self: flex-start; margin-bottom: 6px; }
.login-form { display: flex; flex-direction: column; gap: 14px; margin-top: 8px; }
.login-shell label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--fg-muted); }
.login-shell input[type=text], .login-shell input[type=email], .login-shell input[type=password], .form input { padding: 10px 12px; border-radius: 10px; border: 1px solid var(--border); font-size: 14px; font-family: var(--font-sans); background: var(--bg-surface); color: var(--fg-strong); }
.login-shell input:focus, .form input:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
.login-remember { flex-direction: row !important; align-items: center; gap: 8px; font-weight: 500; }
.login-error { color: #B42318; font-size: 13px; font-weight: 600; background: #FEF3F2; border: 1px solid #FECDCA; padding: 8px 12px; border-radius: 9px; margin: 0; }

.form { display: flex; flex-direction: column; gap: 12px; max-width: 420px; }
.form label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; font-weight: 600; color: var(--fg-muted); }

.status-progress { margin-bottom: 20px; }
.status-progress-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.status-progress-metric { margin-top: 6px; display: flex; align-items: baseline; gap: 8px; }
.status-progress-metric .t-numeric { font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--fg-strong); }
.status-progress-metric .muted { font-size: 14px; }
.status-progress-dist { display: flex; gap: 18px; flex-wrap: wrap; }
.status-progress-cell { display: flex; flex-direction: column; gap: 2px; min-width: 64px; }
.status-progress-cell .t-numeric { font-size: 19px; font-weight: 700; }
.status-bar { display: flex; height: 12px; border-radius: 999px; overflow: hidden; background: var(--bg-sunken); }
.status-bar-seg { height: 100%; }

.kanban { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; align-items: start; }
.kanban-col { background: var(--bg-sunken); border: 1px solid var(--border-subtle); border-radius: 14px; padding: 12px; min-height: 200px; transition: border-color .15s var(--ease-out), background .15s var(--ease-out); }
.kanban-col.drag-over { border-color: var(--brand); background: var(--brand-tint); }
.kanban-col-head { display: flex; align-items: center; gap: 8px; padding: 2px 4px 12px; }
.kanban-col-title { font-family: var(--font-display); font-size: 14px; font-weight: 600; color: var(--fg-strong); }
.kanban-col-count { margin-left: auto; font-size: 12.5px; font-weight: 600; color: var(--fg-subtle); background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 999px; padding: 1px 8px; }
.kanban-col-body { display: flex; flex-direction: column; gap: 10px; }
.kanban-empty { padding: 18px 8px; text-align: center; font-size: 12.5px; color: var(--fg-faint); }

.status-card { background: var(--bg-surface); border: 1px solid var(--border-subtle); border-radius: 12px; padding: 12px; display: flex; flex-direction: column; gap: 10px; box-shadow: var(--shadow-xs); cursor: grab; }
.status-card:active { cursor: grabbing; }
.status-card-top { display: flex; align-items: flex-start; gap: 9px; }
.status-card-meta { flex: 1; min-width: 0; }
.status-card-topic { font-size: 13px; font-weight: 600; color: var(--fg-strong); line-height: 1.3; }
.status-card-sub { font-size: 11.5px; color: var(--fg-subtle); margin-top: 2px; }
.status-card-foot { display: flex; align-items: center; gap: 6px; }
.status-card-moves { margin-left: auto; display: flex; gap: 4px; }
.move-btn { width: 26px; height: 26px; border-radius: 7px; border: 1px solid var(--border); background: var(--bg-surface); color: var(--fg-muted); display: inline-flex; align-items: center; justify-content: center; }
.move-btn:hover:not(:disabled) { background: var(--bg-sunken); }

.team-grid { display: grid; grid-template-columns: 360px 1fr; gap: 20px; align-items: start; max-width: 1120px; }
.team-form-head { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; }
.team-form-head .icon-badge { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; background: var(--brand-tint); color: var(--brand); display: inline-flex; align-items: center; justify-content: center; }
.role-options { display: flex; flex-direction: column; gap: 7px; }
.role-option { display: flex; align-items: flex-start; gap: 10px; text-align: left; padding: 9px 11px; border-radius: 9px; border: 1px solid var(--border); background: var(--bg-surface); }
.role-option.on { border-color: var(--brand); background: var(--brand-tint); }
.role-option .role-name { display: block; font-size: 13px; font-weight: 600; color: var(--fg-strong); }
.role-option .role-desc { display: block; font-size: 11.5px; color: var(--fg-muted); line-height: 1.4; margin-top: 1px; }
.team-list { padding: 0; overflow: hidden; }
.team-list-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border-subtle); }
.team-row { display: flex; align-items: center; gap: 14px; padding: 14px 20px; border-bottom: 1px solid var(--border-subtle); }
.team-row:last-child { border-bottom: none; }
.team-row-id { flex: 1; min-width: 0; }
.team-row-name { font-size: 14px; font-weight: 600; color: var(--fg-strong); }
.team-row-email { display: flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--fg-muted); }
.team-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; font-weight: 500; min-width: 78px; }
.team-status.active { color: #166B46; }
.remove-btn { width: 32px; height: 32px; border-radius: 8px; border: 1px solid var(--border); background: var(--bg-surface); color: var(--fg-subtle); display: inline-flex; align-items: center; justify-content: center; }
.remove-btn:hover:not(:disabled) { background: var(--bg-sunken); color: #B42318; }
.avatar { border-radius: 50%; flex-shrink: 0; color: #fff; display: inline-flex; align-items: center; justify-content: center; font-family: var(--font-display); font-weight: 600; }
