/* ════════════════════════════════════════════════════════════════════════
   TieredUp Hub — Stylesheet
   Mobile-first dark theme inspired by Slack's dark mode.
   ════════════════════════════════════════════════════════════════════════ */

:root {
    /* Palette — deep background with burgundy accent matching the Slack screenshot */
    --bg:           #0d0e14;
    --bg-elev-1:    #16181f;
    --bg-elev-2:    #1d202a;
    --bg-elev-3:    #262a36;
    --sidebar:      #14111c;
    --border:       #2a2d39;
    --border-soft:  #20232c;

    --text:         #e6e6ea;
    --text-muted:   #8a8d96;
    --text-dim:     #5d6068;

    /* Brand */
    --primary:      #7c3aed;       /* purple */
    --primary-hover:#8b4af0;
    --primary-text: #ffffff;

    /* Status colors */
    --success:      #16a34a;
    --warning:      #ca8a04;
    --danger:       #b91c1c;
    --danger-soft:  rgba(185,28,28,0.15);
    --info:         #0ea5e9;

    /* Urgency badges (matching screenshot) */
    --urgency-expedite:  #dc2626;
    --urgency-past-due:  #7c3aed;
    --urgency-normal:    #3b82f6;

    --radius:       8px;
    --radius-lg:    12px;
    --shadow-sm:    0 1px 2px rgba(0,0,0,0.4);
    --shadow-md:    0 4px 12px rgba(0,0,0,0.5);

    --font-sans:    -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
    background: var(--bg);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
    min-height: 100vh;
}

body { min-height: 100dvh; }

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ─── Auth pages (login, forgot, reset) ──────────────────────────────── */

body.auth {
    background:
        radial-gradient(circle at 20% 10%, rgba(124,58,237,0.10), transparent 50%),
        radial-gradient(circle at 80% 90%, rgba(124,58,237,0.06), transparent 50%),
        var(--bg);
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-wrap {
    width: 100%;
    max-width: 420px;
}

.auth-card {
    background: var(--bg-elev-1);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 32px 28px;
    box-shadow: var(--shadow-md);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 28px;
}

.auth-brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--primary), #5b21b6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 20px;
}

.auth-brand-name {
    font-size: 18px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.auth-title {
    font-size: 22px;
    margin-bottom: 6px;
    letter-spacing: -0.01em;
}

.auth-subtitle {
    color: var(--text-muted);
    margin-bottom: 20px;
    font-size: 14px;
}

.auth-foot {
    margin-top: 18px;
    text-align: center;
    font-size: 14px;
}

/* ─── App shell (sidebar + main) ─────────────────────────────────────── */

body.app {
    display: flex;
    min-height: 100vh;
    min-height: 100dvh;
}

.sidebar {
    width: 260px;
    background: var(--sidebar);
    border-right: 1px solid var(--border-soft);
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
    position: sticky;
    top: 0;
    height: 100vh;
    height: 100dvh;
    overflow-y: auto;
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-soft);
}

.workspace {
    display: flex;
    align-items: center;
    gap: 10px;
}

.workspace-icon {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--primary), #5b21b6);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 16px;
}

.workspace-name {
    font-weight: 600;
    letter-spacing: -0.01em;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 8px;
    overflow-y: auto;
}

.nav-section-title {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-dim);
    padding: 14px 12px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 6px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 14px;
    transition: background 0.15s, color 0.15s;
}

.nav-item:hover {
    background: var(--bg-elev-2);
    color: var(--text);
    text-decoration: none;
}

.nav-icon {
    width: 20px;
    text-align: center;
    font-size: 15px;
    opacity: 0.85;
}

.nav-label { flex: 1; }

.nav-meta {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.muted { color: var(--text-dim); }

.sidebar-footer {
    border-top: 1px solid var(--border-soft);
    padding: 12px;
}

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 6px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--bg-elev-3);
    color: var(--text);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
    flex-shrink: 0;
}

.user-info { flex: 1; min-width: 0; }

.user-name {
    font-size: 14px;
    font-weight: 500;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.user-role {
    font-size: 11px;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.user-logout {
    padding: 6px 8px;
    color: var(--text-muted);
    font-size: 18px;
    border-radius: 6px;
}

.user-logout:hover {
    background: var(--bg-elev-2);
    color: var(--text);
    text-decoration: none;
}

.main {
    flex: 1;
    min-width: 0;
    padding: 24px 28px;
}

/* ─── Mobile sidebar toggle ──────────────────────────────────────────── */

.sidebar-toggle {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 100;
    width: 40px;
    height: 40px;
    border: none;
    background: var(--bg-elev-1);
    border-radius: 8px;
    cursor: pointer;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: 4px;
}

.sidebar-toggle span {
    display: block;
    width: 18px;
    height: 2px;
    background: var(--text);
    border-radius: 1px;
}

@media (max-width: 768px) {
    .sidebar-toggle { display: flex; }

    .sidebar {
        position: fixed;
        z-index: 50;
        transform: translateX(-100%);
        transition: transform 0.2s;
    }

    .sidebar.open { transform: translateX(0); }

    .main {
        padding: 64px 16px 16px;
        width: 100%;
    }
}

/* ─── Page header & layout ───────────────────────────────────────────── */

.page { max-width: 1200px; }

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}

.page-title {
    font-size: 24px;
    font-weight: 600;
    letter-spacing: -0.01em;
}

.toolbar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
}

/* ─── Forms ──────────────────────────────────────────────────────────── */

.field { display: block; margin-bottom: 16px; }

.field-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--text);
}

.field-inline {
    display: flex;
    align-items: center;
    gap: 8px;
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="search"],
input[type="number"],
input[type="tel"],
input[type="url"],
select,
textarea {
    width: 100%;
    padding: 11px 13px;
    background: var(--bg-elev-2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-family: var(--font-sans);
    font-size: 15px;
    transition: border-color 0.15s, background 0.15s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    background: var(--bg-elev-3);
}

input:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

input[type="checkbox"] { width: auto; }

.hint {
    display: block;
    margin-top: 5px;
    color: var(--text-dim);
    font-size: 12px;
}

.search-input { max-width: 320px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, transform 0.05s;
    text-decoration: none;
    line-height: 1.2;
}

.btn:active { transform: translateY(1px); }

.btn-primary {
    background: var(--primary);
    color: var(--primary-text);
}

.btn-primary:hover {
    background: var(--primary-hover);
    text-decoration: none;
}

.btn-secondary {
    background: transparent;
    border-color: var(--border);
    color: var(--text);
}

.btn-secondary:hover {
    background: var(--bg-elev-2);
    text-decoration: none;
}

.btn-block { width: 100%; }

.form-card { padding: 24px; max-width: 600px; }

.form-actions {
    display: flex;
    gap: 8px;
    margin-top: 8px;
}

/* ─── Cards ──────────────────────────────────────────────────────────── */

.card {
    background: var(--bg-elev-1);
    border: 1px solid var(--border-soft);
    border-radius: var(--radius-lg);
    padding: 20px;
    margin-bottom: 16px;
}

.card.no-padding { padding: 0; overflow: hidden; }

.card h2 { margin-bottom: 12px; font-size: 18px; }
.card h3 { margin: 16px 0 8px; font-size: 15px; color: var(--text-muted); }
.card p { color: var(--text-muted); margin-bottom: 12px; }
.card ul, .card ol { padding-left: 22px; color: var(--text-muted); }
.card li { margin-bottom: 4px; }

/* ─── Alerts / Flash ─────────────────────────────────────────────────── */

.alert {
    padding: 12px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.alert-error {
    background: var(--danger-soft);
    border: 1px solid rgba(185,28,28,0.4);
    color: #fca5a5;
}

.alert-info {
    background: rgba(14,165,233,0.12);
    border: 1px solid rgba(14,165,233,0.35);
    color: #7dd3fc;
}

.flash {
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 14px;
}

.flash-success {
    background: rgba(22,163,74,0.15);
    border: 1px solid rgba(22,163,74,0.4);
    color: #86efac;
}

.flash-error {
    background: var(--danger-soft);
    border: 1px solid rgba(185,28,28,0.4);
    color: #fca5a5;
}

/* ─── Tables ─────────────────────────────────────────────────────────── */

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table th, .data-table td {
    padding: 12px 16px;
    text-align: left;
    border-bottom: 1px solid var(--border-soft);
}

.data-table th {
    background: var(--bg-elev-2);
    font-weight: 500;
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--text-muted);
}

.data-table tbody tr:hover { background: var(--bg-elev-2); }

.data-table td.empty {
    text-align: center;
    padding: 32px;
    color: var(--text-dim);
}

.cell-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.cell-avatar {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    background: var(--bg-elev-3);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 12px;
    flex-shrink: 0;
}

.row-actions { text-align: right; }

/* ─── Pills / badges ─────────────────────────────────────────────────── */

.pill {
    display: inline-block;
    padding: 3px 9px;
    border-radius: 12px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.pill-admin    { background: rgba(124,58,237,0.20); color: #c4b5fd; }
.pill-manager  { background: rgba(14,165,233,0.20); color: #7dd3fc; }
.pill-tech     { background: rgba(100,116,139,0.20); color: #cbd5e1; }
.pill-active   { background: rgba(22,163,74,0.20); color: #86efac; }
.pill-inactive { background: rgba(100,116,139,0.20); color: #94a3b8; }

.link { color: var(--primary); }

/* ─── Mobile tweaks ──────────────────────────────────────────────────── */

@media (max-width: 640px) {
    .page-title { font-size: 20px; }

    .data-table th, .data-table td { padding: 10px 12px; }

    .data-table th:nth-child(2),
    .data-table td:nth-child(2),
    .data-table th:nth-child(5),
    .data-table td:nth-child(5) {
        display: none;
    }

    .form-actions { flex-direction: column; }
    .form-actions .btn { width: 100%; }
}
