/* ──────────────────────────────────────────────────────────────────────
   Apple-inspired design system
   - Clarity:   precise typography, generous whitespace, hairline borders
   - Deference: surfaces stay out of the way, content leads
   - Depth:     subtle layering, blur, soft shadows
   ────────────────────────────────────────────────────────────────────── */

:root {
    /* Surfaces — macOS dark mode palette */
    --bg:           #1c1c1e;
    --bg-elevated:  #2c2c2e;
    --bg-grouped:   #1c1c1e;
    --bg-card:      rgba(58, 58, 60, 0.6);
    --bg-card-hover: rgba(72, 72, 74, 0.7);
    --bg-input:     rgba(58, 58, 60, 0.4);
    --bg-glass:     rgba(28, 28, 30, 0.72);

    /* Borders */
    --separator:    rgba(255, 255, 255, 0.08);
    --border:       rgba(255, 255, 255, 0.12);
    --border-focus: rgba(10, 132, 255, 0.6);

    /* Text */
    --text:         #f5f5f7;
    --text-secondary: rgba(235, 235, 245, 0.65);
    --text-tertiary:  rgba(235, 235, 245, 0.42);
    --text-muted:   rgba(235, 235, 245, 0.42);

    /* Accent — Apple system blue */
    --primary:       #0a84ff;
    --primary-hover: #409cff;
    --primary-bg:    rgba(10, 132, 255, 0.15);

    /* Status — Apple system colors */
    --danger:   #ff453a;
    --success:  #30d158;
    --warning:  #ff9f0a;
    --info:     #64d2ff;

    /* Geometry */
    --radius-sm:  6px;
    --radius:     10px;
    --radius-lg:  14px;
    --radius-xl:  18px;

    /* Typography */
    --font: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'SF Pro Display',
            'Helvetica Neue', system-ui, sans-serif;
    --font-mono: 'SF Mono', ui-monospace, 'Menlo', monospace;

    /* Shadow */
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.2);
    --shadow:    0 4px 16px rgba(0, 0, 0, 0.24);
    --shadow-lg: 0 12px 40px rgba(0, 0, 0, 0.32);
}

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

html, body { height: 100%; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    font-size: 14px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    font-feature-settings: "ss01", "cv11";
    letter-spacing: -0.003em;
}

/* Typography hierarchy — Apple HIG sizes */
h1 { font-size: 28px; font-weight: 700; letter-spacing: -0.022em; line-height: 1.14; }
h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.019em; line-height: 1.18; }
h3 { font-size: 17px; font-weight: 600; letter-spacing: -0.014em; line-height: 1.29; }
h4 { font-size: 15px; font-weight: 600; letter-spacing: -0.012em; line-height: 1.33; }
p  { color: var(--text); }

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

code {
    font-family: var(--font-mono);
    font-size: 0.85em;
    background: var(--bg-input);
    padding: 1px 6px;
    border-radius: 4px;
    color: var(--info);
}

/* ───── Navbar — translucent, sticky, frosted ───── */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0 20px;
    height: 48px;
    border-bottom: 0.5px solid var(--separator);
    background: var(--bg-glass);
    backdrop-filter: saturate(180%) blur(20px);
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    position: sticky;
    top: 0;
    z-index: 100;
}
.navbar-brand .logo {
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    font-size: 15px;
    letter-spacing: -0.012em;
}
.navbar-menu { display: flex; gap: 4px; align-items: center; }
.nav-link {
    color: var(--text-secondary);
    text-decoration: none;
    font-size: 13px;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}
.nav-link:hover {
    color: var(--text);
    background: var(--bg-card);
    text-decoration: none;
}

/* ───── Container ───── */
.container { max-width: 1100px; margin: 0 auto; padding: 32px 24px; }
.container-narrow { max-width: 640px; }

/* ───── Page header ───── */
.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 28px;
    gap: 16px;
}
.page-header h1 { margin-bottom: 4px; }
.page-header p { color: var(--text-secondary); font-size: 15px; }

/* ───── Cards — translucent, layered ───── */
.card {
    background: var(--bg-card);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 20px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    transition: background 0.2s ease, transform 0.15s ease;
}
.card-link {
    display: block;
    text-decoration: none;
    color: var(--text);
}
.card-link:hover {
    text-decoration: none;
}
.card-link:hover .card,
a.card:hover {
    background: var(--bg-card-hover);
}
.card h3 { margin-bottom: 6px; }

/* Grids */
.company-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.overview-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}

/* ───── Badges — pill style ───── */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.01em;
    text-transform: uppercase;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-secondary);
}
.badge-active  { background: rgba(48, 209, 88, 0.16);  color: var(--success); }
.badge-genesis { background: rgba(10, 132, 255, 0.16); color: var(--primary); }
.badge-failed  { background: rgba(255, 69, 58, 0.16);  color: var(--danger); }

/* ───── Buttons — Apple style with depth ───── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: -0.005em;
    text-decoration: none;
    border: none;
    cursor: pointer;
    font-family: var(--font);
    transition: transform 0.08s ease, background 0.15s ease, box-shadow 0.15s ease;
    line-height: 1;
    min-height: 32px;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: scale(0.97); }

.btn-primary {
    background: var(--primary);
    color: white;
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.18) inset, 0 1px 2px rgba(0, 0, 0, 0.2);
}
.btn-primary:hover { background: var(--primary-hover); }

.btn-secondary {
    background: var(--bg-card);
    color: var(--text);
    border: 0.5px solid var(--border);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.btn-secondary:hover { background: var(--bg-card-hover); }

.btn-full { width: 100%; }
.btn-link {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    font-family: var(--font);
    font-size: 13px;
    padding: 6px 12px;
    border-radius: var(--radius-sm);
    transition: background 0.15s ease, color 0.15s ease;
}
.btn-link:hover { color: var(--text); background: var(--bg-card); }

/* ───── Forms ───── */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block;
    margin-bottom: 6px;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    letter-spacing: -0.003em;
}
.form-group input:not([type="checkbox"]):not([type="radio"]),
.form-group textarea,
.form-group select {
    width: 100%;
    padding: 10px 12px;
    background: var(--bg-input);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    color: var(--text);
    font-size: 14px;
    font-family: var(--font);
    line-height: 1.4;
    transition: border-color 0.15s ease, background 0.15s ease;
}

/* Checkboxes — native style, sized properly */
.form-group input[type="checkbox"],
.form-group input[type="radio"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
    margin: 0;
}

/* Checkbox label — inline, label first */
.form-group label.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    color: var(--text);
    font-size: 14px;
    margin-bottom: 0;
}
.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
    outline: none;
    border-color: var(--border-focus);
    background: var(--bg-elevated);
    box-shadow: 0 0 0 4px rgba(10, 132, 255, 0.15);
}
.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-tertiary);
}
.form-group textarea {
    resize: vertical;
    font-family: var(--font-mono);
    font-size: 13px;
    line-height: 1.5;
}
.form-stack { display: flex; flex-direction: column; }
.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    margin-top: 20px;
}

/* ───── Auth ───── */
.auth-container {
    max-width: 380px;
    margin: 80px auto;
    padding: 32px;
    background: var(--bg-card);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-xl);
    backdrop-filter: blur(40px);
    -webkit-backdrop-filter: blur(40px);
    box-shadow: var(--shadow-lg);
}
.auth-container h1 {
    text-align: center;
    margin-bottom: 6px;
    font-size: 24px;
}
.subtitle {
    text-align: center;
    color: var(--text-secondary);
    margin-bottom: 28px;
    font-size: 14px;
}
.auth-form { margin-bottom: 16px; }
.auth-divider {
    text-align: center;
    position: relative;
    margin: 20px 0;
    color: var(--text-tertiary);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.auth-divider::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 0.5px solid var(--separator);
}
.auth-divider span {
    background: var(--bg);
    padding: 0 12px;
    position: relative;
}
.auth-footer {
    text-align: center;
    font-size: 13px;
    color: var(--text-secondary);
    margin-top: 20px;
}
.auth-footer a { color: var(--primary); font-weight: 500; }

/* ───── Alerts ───── */
.alert {
    padding: 12px 16px;
    border-radius: var(--radius);
    margin-bottom: 16px;
    font-size: 13px;
    border: 0.5px solid transparent;
}
.alert-error {
    background: rgba(255, 69, 58, 0.12);
    color: var(--danger);
    border-color: rgba(255, 69, 58, 0.24);
}

/* ───── Tabs (company nav) ───── */
.company-nav {
    display: flex;
    gap: 4px;
    padding: 4px;
    margin-bottom: 28px;
    background: var(--bg-card);
    border: 0.5px solid var(--border);
    border-radius: var(--radius);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    overflow-x: auto;
}
.tab {
    padding: 6px 14px;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius-sm);
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}
.tab:hover {
    color: var(--text);
    background: rgba(255, 255, 255, 0.04);
    text-decoration: none;
}
.tab.active {
    color: var(--text);
    background: var(--bg-elevated);
    box-shadow: var(--shadow-sm);
}

/* ───── Data tables — inset list style ───── */
.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.data-table th,
.data-table td {
    padding: 12px 16px;
    text-align: left;
    font-size: 13px;
    border-bottom: 0.5px solid var(--separator);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table th {
    color: var(--text-secondary);
    font-weight: 600;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    background: rgba(255, 255, 255, 0.02);
}
.data-table tbody tr {
    transition: background 0.15s ease;
}
.data-table tbody tr:hover {
    background: rgba(255, 255, 255, 0.03);
}
.data-table code {
    background: transparent;
    padding: 0;
    color: var(--info);
}

/* ───── Inline forms ───── */
.form-inline { display: flex; flex-direction: column; gap: 12px; }
.form-row {
    display: flex;
    gap: 12px;
    align-items: flex-end;
    flex-wrap: wrap;
}
.form-row .form-group { flex: 1; min-width: 160px; margin-bottom: 0; }
.form-row .btn { flex-shrink: 0; }

/* ───── Misc ───── */
.text-muted { color: var(--text-secondary); }
.empty-state {
    text-align: center;
    padding: 64px 24px;
    color: var(--text-secondary);
}
.empty-state h2 {
    margin-bottom: 8px;
    color: var(--text);
}
.empty-state p {
    color: var(--text-secondary);
    margin-bottom: 20px;
    font-size: 14px;
}

.seed-prompt {
    white-space: pre-wrap;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    background: var(--bg-input);
    padding: 12px;
    border-radius: var(--radius);
    max-height: 200px;
    overflow-y: auto;
    line-height: 1.5;
}

.blueprint-content {
    white-space: pre-wrap;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text);
    background: var(--bg-input);
    padding: 16px;
    border-radius: var(--radius);
    border: 0.5px solid var(--separator);
    max-height: 400px;
    overflow-y: auto;
    line-height: 1.6;
}
.blueprint-sections a { color: var(--primary); }

/* ───── Breadcrumbs ───── */
.breadcrumbs {
    font-size: 13px;
    color: var(--text-secondary);
}
.breadcrumbs a {
    color: var(--primary);
    text-decoration: none;
}
.breadcrumbs a:hover { text-decoration: underline; }

/* ───── Git log — inset list ───── */
.git-log {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.git-commit {
    display: flex;
    align-items: baseline;
    gap: 12px;
    padding: 12px 16px;
    border-bottom: 0.5px solid var(--separator);
    font-size: 13px;
    transition: background 0.15s ease;
}
.git-commit:last-child { border-bottom: none; }
.git-commit:hover { background: rgba(255, 255, 255, 0.03); }
.git-sha {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--info);
    background: var(--bg-input);
    padding: 2px 6px;
    border-radius: 4px;
    flex-shrink: 0;
}
.git-meta {
    font-size: 11px;
    margin-left: auto;
    flex-shrink: 0;
    white-space: nowrap;
    color: var(--text-tertiary);
}

/* ───── Calendar — inset list ───── */
.event-list {
    display: flex;
    flex-direction: column;
    background: var(--bg-card);
    border: 0.5px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}
.event-row {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 14px 16px;
    border-bottom: 0.5px solid var(--separator);
    transition: background 0.15s ease;
}
.event-row:last-child { border-bottom: none; }
.event-row:hover { background: rgba(255, 255, 255, 0.03); }
.event-date {
    flex-shrink: 0;
    font-family: var(--font-mono);
    font-size: 12px;
    color: var(--text-secondary);
    min-width: 110px;
}
.event-title { flex: 1; font-size: 14px; }
.event-completed {
    text-decoration: line-through;
    color: var(--text-tertiary);
}
.event-status { flex-shrink: 0; }
.event-actions { flex-shrink: 0; }

/* ───── Scrollbars ───── */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 999px;
    border: 3px solid var(--bg);
    background-clip: padding-box;
}
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.2); background-clip: padding-box; border: 3px solid var(--bg); }

/* ───── Selection ───── */
::selection {
    background: rgba(10, 132, 255, 0.35);
    color: var(--text);
}

/* ───── Notifications ───── */
.badge-unread {
    background: var(--primary);
    color: #fff;
    margin-left: 6px;
    min-width: 18px;
    justify-content: center;
}

.filter-tabs {
    display: flex;
    gap: 4px;
    margin: 16px 0;
    border-bottom: 1px solid var(--separator);
}
.filter-tab {
    padding: 8px 14px;
    color: var(--text-secondary);
    text-decoration: none;
    border-bottom: 2px solid transparent;
    font-size: 13px;
    font-weight: 500;
}
.filter-tab.active {
    color: var(--text);
    border-bottom-color: var(--primary);
}

.notification-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.notification-item {
    border-bottom: 1px solid var(--separator);
}
.notification-link {
    display: block;
    padding: 14px 16px;
    color: var(--text);
    text-decoration: none;
    transition: background 0.15s ease;
}
.notification-link:hover { background: var(--bg-card); }
.notification-unread .notification-link {
    border-left: 3px solid var(--primary);
    padding-left: 13px;
    background: rgba(10, 132, 255, 0.04);
}
.notification-unread .notification-title { font-weight: 600; }
.notification-title { font-size: 14px; margin-bottom: 4px; }
.notification-body { font-size: 13px; color: var(--text-secondary); margin-bottom: 4px; }
.notification-meta { font-size: 11px; color: var(--text-tertiary); }

.settings-section {
    margin-top: 24px;
    padding: 20px;
    background: var(--bg-card);
    border-radius: var(--radius);
}
.settings-section h2 { margin-top: 0; font-size: 16px; }
.settings-form {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-top: 16px;
}
.checkbox {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 14px;
}
