/* ==========================================================================
   MLS Internship Portal, design system
   One light theme, professional and institutional. No dark mode by request.
   ========================================================================== */

:root {
    /* Neutrals, cool and calm */
    --bg: #f4f6f9;
    --surface: #ffffff;
    --surface-2: #f0f3f7;
    --surface-3: #e9eef4;

    --text: #1b2430;
    --muted: #57616f;
    --faint: #8a94a3;

    --border: #e2e7ee;
    --border-strong: #cfd7e2;

    /* Primary, a professional teal */
    --primary: #0f766e;
    --primary-hover: #0b5f58;
    --primary-tint: #e6f2f0;
    --on-primary: #ffffff;

    /* Semantic */
    --success: #1f8f5a;
    --success-tint: #e7f4ed;
    --danger: #c23a2b;
    --danger-tint: #fbecea;
    --warning: #9a6a12;
    --warning-tint: #fbf1dc;
    --info: #0f766e;
    --info-tint: #e6f2f0;

    /* Shape and depth */
    --radius: 12px;
    --radius-sm: 8px;
    --radius-lg: 16px;
    --shadow-sm: 0 1px 2px rgba(20, 36, 48, 0.06);
    --shadow: 0 1px 2px rgba(20, 36, 48, 0.05), 0 10px 24px -14px rgba(20, 36, 48, 0.18);

    --sidebar-w: 250px;

    --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    --font-mono: ui-monospace, "SF Mono", "Cascadia Code", Menlo, Consolas, monospace;
}

/* Reset and base ---------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: var(--font);
    font-size: 15px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { margin: 0; font-weight: 650; line-height: 1.25; letter-spacing: -0.01em; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.25rem; }
h3 { font-size: 1.05rem; }
p { margin: 0.5em 0; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Buttons ----------------------------------------------------------------- */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font: inherit;
    font-weight: 550;
    font-size: 0.95rem;
    line-height: 1;
    padding: 11px 16px;
    border: 1px solid transparent;
    border-radius: var(--radius-sm);
    cursor: pointer;
    background: var(--surface-2);
    color: var(--text);
    transition: background-color 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }

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

.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }

.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover { filter: brightness(0.94); }

/* Forms ------------------------------------------------------------------- */
.form { display: flex; flex-direction: column; gap: 18px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-weight: 550; font-size: 0.92rem; color: var(--text); }
.field input,
.field select,
.field textarea {
    font: inherit;
    font-size: 0.98rem;
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 11px 12px;
    width: 100%;
}
.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-tint);
}
.field-help { margin: 0; font-size: 0.85rem; color: var(--muted); }

/* Alerts ------------------------------------------------------------------ */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: var(--surface-2);
    font-size: 0.92rem;
    margin-bottom: 16px;
}
.alert .alert-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: 0 0 auto; background: var(--faint); }
.alert-success { background: var(--success-tint); border-color: transparent; color: #145a38; }
.alert-success .alert-dot { background: var(--success); }
.alert-error { background: var(--danger-tint); border-color: transparent; color: #7f261c; }
.alert-error .alert-dot { background: var(--danger); }
.alert-warning { background: var(--warning-tint); border-color: transparent; color: #6a480a; }
.alert-warning .alert-dot { background: var(--warning); }
.alert-info { background: var(--info-tint); border-color: transparent; color: #0b524b; }
.alert-info .alert-dot { background: var(--info); }

/* Brand mark -------------------------------------------------------------- */
.brand-mark { color: var(--primary); display: inline-flex; }

/* Sign in screen ---------------------------------------------------------- */
.auth-body { background: var(--bg); }
.auth-wrap {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 32px 20px;
    gap: 16px;
}
.auth-card {
    width: 100%;
    max-width: 400px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
    padding: 28px;
}
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-brand-text { display: flex; flex-direction: column; line-height: 1.3; }
.auth-brand-text strong { font-size: 0.98rem; }
.auth-brand-text span { font-size: 0.82rem; color: var(--muted); }
.auth-head { margin-bottom: 20px; }
.auth-head h1 { font-size: 1.4rem; }
.auth-head p { margin: 6px 0 0; color: var(--muted); font-size: 0.92rem; }
.auth-foot { color: var(--faint); font-size: 0.82rem; text-align: center; max-width: 400px; }

/* Application shell -------------------------------------------------------- */
.app-shell { display: grid; grid-template-columns: var(--sidebar-w) 1fr; min-height: 100vh; }

.sidebar {
    grid-column: 1;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 18px 14px;
    position: sticky;
    top: 0;
    height: 100vh;
}
.sidebar-brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; }
.brand-title { font-weight: 650; letter-spacing: -0.01em; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; flex: 1; }
.nav-link {
    display: block;
    padding: 10px 12px;
    border-radius: var(--radius-sm);
    color: var(--muted);
    font-weight: 500;
    font-size: 0.95rem;
}
.nav-link:hover { background: var(--surface-2); color: var(--text); text-decoration: none; }
.nav-link.is-active { background: var(--primary-tint); color: var(--primary-hover); font-weight: 600; }

.sidebar-foot { border-top: 1px solid var(--border); padding-top: 14px; display: flex; flex-direction: column; gap: 12px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 0 4px; }
.avatar {
    width: 34px; height: 34px; flex: 0 0 auto;
    border-radius: 50%;
    background: var(--primary-tint);
    color: var(--primary-hover);
    display: inline-flex; align-items: center; justify-content: center;
    font-weight: 650; font-size: 0.9rem;
}
.user-meta { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; }
.user-meta strong { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-meta span { font-size: 0.78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.main { grid-column: 2; display: flex; flex-direction: column; min-width: 0; }
.topbar {
    height: 62px;
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 0 26px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    position: sticky;
    top: 0;
    z-index: 20;
}
.page-title { font-size: 1.15rem; font-weight: 650; }
.role-badge {
    margin-left: auto;
    font-size: 0.8rem;
    color: var(--muted);
    background: var(--surface-2);
    border: 1px solid var(--border);
    padding: 5px 11px;
    border-radius: 999px;
    white-space: nowrap;
}
.menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    color: var(--text);
    padding: 6px;
    cursor: pointer;
}

.content { padding: 26px; max-width: 1100px; width: 100%; }

/* Content pieces ---------------------------------------------------------- */
.page-intro { margin-bottom: 22px; }
.page-intro h2 { font-size: 1.35rem; }
.page-intro p { color: var(--muted); max-width: 68ch; }

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 20px 22px;
}
.card h3 { margin-bottom: 6px; }
.card p { color: var(--muted); margin: 0; max-width: 70ch; }
.notice-card { border-left: 3px solid var(--primary); }

.empty-state {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 44px 26px;
    text-align: center;
    box-shadow: var(--shadow-sm);
}
.empty-state h2 { margin-bottom: 8px; }
.empty-state p { color: var(--muted); max-width: 52ch; margin: 0 auto 18px; }

/* Tables ------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.table { border-collapse: collapse; width: 100%; font-size: 0.92rem; }
table.table th, table.table td { text-align: left; padding: 12px 14px; border-bottom: 1px solid var(--border); }
table.table thead th { background: var(--surface-2); color: var(--muted); font-weight: 600; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.02em; }
table.table tbody tr:last-child td { border-bottom: none; }

/* Badges ------------------------------------------------------------------ */
.badge { display: inline-flex; align-items: center; font-size: 0.78rem; font-weight: 600; padding: 3px 9px; border-radius: 999px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }

/* Mobile ------------------------------------------------------------------ */
.sidebar-scrim { display: none; }

@media (max-width: 860px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: 0; top: 0; bottom: 0;
        width: var(--sidebar-w);
        z-index: 40;
        transform: translateX(-100%);
        transition: transform 0.2s ease;
    }
    .app-shell.nav-open .sidebar { transform: translateX(0); }
    .main { grid-column: 1; }
    .menu-toggle { display: inline-flex; }
    .sidebar-scrim {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(20, 36, 48, 0.4);
        z-index: 35;
    }
    .sidebar-scrim[hidden] { display: none; }
    .content { padding: 20px; }
}

/* Management pages -------------------------------------------------------- */
.page-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; flex-wrap: wrap; }
.page-header h2 { font-size: 1.35rem; }
.page-header p { color: var(--muted); margin: 6px 0 0; max-width: 66ch; }
.page-header .btn { flex: 0 0 auto; }

.nav-group-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--faint); font-weight: 650; padding: 14px 12px 6px; }

.btn-sm { padding: 7px 11px; font-size: 0.86rem; }

.table-actions { display: flex; gap: 8px; align-items: center; }
.table-actions form { margin: 0; }
.col-actions { width: 1%; white-space: nowrap; }
.col-order { width: 72px; }
.row-sub { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }

.badge-success { background: var(--success-tint); color: #145a38; border-color: transparent; }
.badge-neutral { background: var(--surface-3); color: var(--muted); border-color: transparent; }
.badge-primary { background: var(--primary-tint); color: var(--primary-hover); border-color: transparent; margin-left: 6px; }

.mono { font-family: var(--font-mono); font-size: 0.9em; }
.text-faint { color: var(--faint); }

.form-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
    padding: 24px;
    max-width: 620px;
}
.field-error { margin: 0; font-size: 0.85rem; color: var(--danger); font-weight: 500; }
.optional { color: var(--faint); font-weight: 400; font-size: 0.86em; }
.checkbox-field { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.checkbox-field input { margin-top: 3px; width: 16px; height: 16px; flex: 0 0 auto; accent-color: var(--primary); }
.checkbox-field > span { display: flex; flex-direction: column; gap: 3px; }
.checkbox-field strong { font-weight: 550; font-size: 0.92rem; }
.form-actions { display: flex; gap: 10px; padding-top: 4px; }

/* Group detail, member picker ------------------------------------------- */
.stack { display: flex; flex-direction: column; gap: 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-sub { color: var(--muted); font-size: 0.9rem; margin: 4px 0 0; }
.pick-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 2px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 10px;
    max-height: 340px;
    overflow-y: auto;
}
.pick-item { display: flex; align-items: center; gap: 9px; padding: 6px 7px; border-radius: 6px; cursor: pointer; font-size: 0.92rem; }
.pick-item:hover { background: var(--surface-2); }
.pick-item input { width: 15px; height: 15px; accent-color: var(--primary); flex: 0 0 auto; }

@media (prefers-reduced-motion: reduce) {
    * { transition: none !important; }
}
