:root {
    --bg: #eef2f6;
    --bg-soft: #dfe6ed;
    --panel: #ffffff;
    --panel-strong: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --accent: #1f5f8b;
    --accent-soft: #dcecf7;
    --warning: #d97706;
    --danger: #b91c1c;
    --success: #15803d;
    --border: rgba(31, 41, 55, 0.12);
    --shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
    --radius: 16px;
    --radius-sm: 12px;
    --sans: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--sans);
    font-size: 16px;
    color: var(--text);
    background: var(--bg);
}

a {
    color: inherit;
    text-decoration: none;
}

code {
    display: inline-block;
    padding: 0.2rem 0.45rem;
    border-radius: 999px;
    background: rgba(8, 18, 17, 0.08);
    font-family: "SFMono-Regular", Menlo, Consolas, monospace;
    font-size: 0.88rem;
}

h1, h2, h3, h4, h5 {
    margin: 0;
    font-family: var(--sans);
    font-weight: 600;
    letter-spacing: -0.01em;
}

p {
    margin: 0;
}

small {
    color: var(--muted);
}

table {
    width: 100%;
    border-collapse: collapse;
}

th, td {
    padding: 1rem 0.9rem;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid rgba(16, 34, 33, 0.08);
}

th {
    color: var(--muted);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

input,
select,
textarea,
button {
    font: inherit;
    font-size: 16px;
}

input,
select,
textarea {
    width: 100%;
    padding: 0.95rem 1rem;
    border: 1px solid rgba(15, 118, 110, 0.2);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.92);
    color: var(--text);
}

textarea {
    resize: vertical;
}

label {
    display: grid;
    gap: 0.5rem;
    color: var(--muted);
    font-size: 0.92rem;
}

.button {
    display: inline-flex;
    justify-content: center;
    align-items: center;
    gap: 0.45rem;
    padding: 0.9rem 1.1rem;
    border: 0;
    border-radius: 16px;
    cursor: pointer;
    transition: transform 0.18s ease, background 0.18s ease, opacity 0.18s ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

.button.primary {
    background: #1f5f8b;
    color: white;
}

.button.subtle,
.button.ghost {
    background: rgba(16, 34, 33, 0.06);
    color: var(--text);
}

.button.danger {
    background: linear-gradient(135deg, #b91c1c, #7f1d1d);
    color: white;
}

.button.small {
    padding: 0.5rem 0.8rem;
    border-radius: 12px;
    font-size: 0.88rem;
}

.full-width {
    width: 100%;
}

.eyebrow {
    color: var(--accent);
    text-transform: uppercase;
    letter-spacing: 0.14em;
    font-size: 0.72rem;
    font-weight: 700;
    margin-bottom: 0.45rem;
}

.flash {
    padding: 1rem 1.15rem;
    border-radius: 18px;
    margin-bottom: 1rem;
    background: rgba(255, 255, 255, 0.85);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.1);
}

.flash.success {
    border-left: 5px solid var(--success);
}

.flash.danger {
    border-left: 5px solid var(--danger);
}

.flash.warning {
    border-left: 5px solid var(--warning);
}

.guest-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 2rem;
    background: var(--bg);
}

.hero-panel {
    width: min(1100px, 100%);
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 2rem;
    align-items: stretch;
}

.hero-copy,
.auth-card,
.card,
.stat-card {
    background: var(--panel);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
}

.hero-copy {
    padding: 3rem;
    border-radius: 20px;
    color: var(--text);
}

.hero-copy h1 {
    font-size: clamp(2.4rem, 4vw, 4.1rem);
    line-height: 0.96;
    margin-bottom: 1rem;
}

.hero-copy > p {
    max-width: 36rem;
    color: var(--muted);
    font-size: 1.02rem;
    line-height: 1.6;
}

.credential-card {
    margin-top: 2rem;
    padding: 1.35rem;
    border-radius: 14px;
    background: #f4f6f8;
    border: 1px solid var(--border);
}

.auth-card {
    padding: 2rem;
    border-radius: 20px;
    background: #ffffff;
    display: grid;
    gap: 1rem;
}

.app-shell {
    display: grid;
    grid-template-columns: 290px minmax(0, 1fr);
    min-height: 100vh;
}

.sidebar {
    padding: 1.4rem;
    display: grid;
    grid-template-rows: auto 1fr auto;
    gap: 1.4rem;
    background: #243447;
    border-right: 1px solid rgba(15, 23, 42, 0.1);
}

.brand-card {
    display: flex;
    gap: 0.9rem;
    align-items: center;
    color: #f8fafc;
    padding-bottom: 0.8rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-logo {
    width: 46px;
    height: 46px;
    object-fit: contain;
    flex: 0 0 auto;
}

.brand-card h1 {
    font-size: 1.25rem;
}

.brand-kicker {
    color: rgba(248, 250, 252, 0.7);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-bottom: 0.3rem;
}

.brand-subtitle {
    color: rgba(248, 250, 252, 0.68);
    font-size: 0.9rem;
    margin-top: 0.25rem;
}

.nav-stack {
    display: grid;
    gap: 0.5rem;
    align-content: start;
}

.nav-link {
    padding: 0.9rem 1rem;
    border-radius: 18px;
    color: rgba(255, 255, 255, 0.72);
    transition: background 0.18s ease, color 0.18s ease, transform 0.18s ease;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(255, 255, 255, 0.1);
    color: white;
    transform: none;
}

.sidebar-footer {
    display: grid;
    gap: 0.8rem;
}

.presence-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    padding: 0.85rem 1rem;
    color: white;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
}

.dot {
    width: 10px;
    height: 10px;
    border-radius: 999px;
    background: #d97706;
    box-shadow: 0 0 0 0 rgba(217, 119, 6, 0.45);
}

.dot.online {
    background: #34d399;
}

.workspace {
    padding: 1.6rem;
}

.workspace-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: center;
    margin-bottom: 1.2rem;
    color: var(--text);
}

.workspace-header h2 {
    font-size: clamp(2rem, 2.5vw, 2.8rem);
}

.header-meta {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.header-link {
    display: inline-flex;
    align-items: center;
    gap: 0.55rem;
    min-height: 46px;
    padding: 0.8rem 1rem;
    border-radius: 14px;
    background: rgba(31, 41, 55, 0.05);
    border: 1px solid rgba(31, 41, 55, 0.08);
    color: var(--text);
    font-weight: 600;
}

.header-count {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.7rem;
    height: 1.7rem;
    padding: 0 0.45rem;
    border-radius: 999px;
    background: var(--accent);
    color: #ffffff;
    font-size: 0.78rem;
    line-height: 1;
}

.identity-card {
    display: grid;
    gap: 0.25rem;
    padding: 1rem 1.2rem;
    border-radius: 14px;
    color: var(--text);
    background: #ffffff;
    border: 1px solid var(--border);
}

.identity-card span {
    color: var(--muted);
    font-size: 0.9rem;
}

.page-grid {
    display: grid;
    gap: 1.4rem;
}

.stats-grid,
.card-grid {
    display: grid;
    gap: 1.1rem;
}

.stats-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
}

.card-grid.two-col {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.stat-card,
.card {
    border-radius: var(--radius);
    padding: 1.3rem;
}

.stat-card h3 {
    font-size: 2.2rem;
    margin-bottom: 0.25rem;
}

.card {
    background: var(--panel-strong);
}

.card-header {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    align-items: start;
    margin-bottom: 1rem;
}

.card-header h3 {
    font-size: 1.55rem;
}

.table-wrap {
    overflow: auto;
}

.stack-list {
    display: grid;
    gap: 0.9rem;
}

.stack-list.compact-gap {
    gap: 0.55rem;
}

.stack-item,
.muted-box {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.95rem 1rem;
    border-radius: 18px;
    background: rgba(8, 18, 17, 0.04);
}

.muted-box {
    padding: 0.7rem 0.8rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.38rem 0.7rem;
    border-radius: 999px;
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
}

.badge-info {
    background: rgba(15, 118, 110, 0.12);
    color: #0f766e;
}

.badge-warning {
    background: rgba(217, 119, 6, 0.14);
    color: #b45309;
}

.badge-success {
    background: rgba(22, 163, 74, 0.12);
    color: #15803d;
}

.badge-danger {
    background: rgba(185, 28, 28, 0.12);
    color: #b91c1c;
}

.badge-neutral {
    background: rgba(8, 18, 17, 0.08);
    color: #4b5563;
}

.form-grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.form-grid.compact {
    align-items: end;
}

.form-grid .span-2 {
    grid-column: span 2;
}

.form-actions {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
}

.checkbox-inline {
    display: flex;
    gap: 0.6rem;
    align-items: center;
}

.checkbox-inline input {
    width: auto;
}

.field-inline {
    margin-top: 0.6rem;
}

.inline-filter {
    display: flex;
    gap: 0.8rem;
    align-items: center;
    flex-wrap: wrap;
}

.danger-form {
    margin-top: 1rem;
}

.schedule-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
}

.calendar-wrap {
    overflow: auto;
}

.calendar-grid {
    min-width: 980px;
    table-layout: fixed;
}

.employee-cell {
    min-width: 180px;
    background: rgba(8, 18, 17, 0.03);
}

.calendar-cell {
    min-width: 150px;
    background: rgba(255, 255, 255, 0.7);
}

.mini-shift {
    display: grid;
    gap: 0.25rem;
    padding: 0.65rem;
    border-radius: 14px;
    background: rgba(15, 118, 110, 0.08);
    margin-bottom: 0.55rem;
}

.mini-shift p {
    font-size: 0.9rem;
}

.day-column {
    padding: 1rem;
    border-radius: 20px;
    background: linear-gradient(180deg, rgba(15, 118, 110, 0.08), rgba(8, 18, 17, 0.03));
    display: grid;
    gap: 0.8rem;
    align-content: start;
}

.schedule-card,
.job-card {
    padding: 1rem;
    border-radius: 18px;
    background: white;
    box-shadow: 0 12px 26px rgba(16, 34, 33, 0.08);
    display: grid;
    gap: 0.55rem;
}

.card-line {
    display: flex;
    justify-content: space-between;
    gap: 0.8rem;
    align-items: start;
}

.kanban-board {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1rem;
}

.kanban-column {
    padding: 1rem;
    border-radius: 22px;
    background: rgba(8, 18, 17, 0.04);
    display: grid;
    gap: 0.85rem;
    align-content: start;
}

.kanban-column > header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.inline-log-form {
    display: grid;
    gap: 0.7rem;
    margin-top: 0.5rem;
}

.template-row {
    align-items: center;
}

.embed-body {
    background: #f3f7f6;
    color: var(--text);
}

.embed-shell {
    padding: 1rem;
}

.embed-header {
    margin-bottom: 1rem;
}

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

.helper-text {
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.5;
}

.status-strip,
.stats-inline {
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: rgba(8, 18, 17, 0.05);
}

.attendance-panel {
    position: relative;
    overflow: hidden;
}

.attendance-panel::after {
    content: "";
    position: absolute;
    inset: auto -80px -80px auto;
    width: 180px;
    height: 180px;
    border-radius: 999px;
    background: radial-gradient(circle, rgba(15, 118, 110, 0.14), transparent 65%);
}

.empty-state {
    padding: 3rem;
    text-align: center;
}

.empty-state.slim {
    padding: 1rem 0;
    text-align: left;
}

.compact-list {
    margin: 1rem 0 0;
    padding-left: 1rem;
    display: grid;
    gap: 0.5rem;
}

.api-docs {
    display: grid;
    gap: 0.9rem;
}

.payroll-figure {
    display: grid;
    gap: 0.35rem;
    margin-bottom: 1rem;
}

.payroll-figure strong {
    font-size: 2rem;
}

.guest-flash {
    width: min(1100px, 100%);
}

.app-gate {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 1.25rem;
    background: rgba(15, 23, 42, 0.72);
    backdrop-filter: blur(3px);
}

.app-gate[hidden] {
    display: none;
}

.app-gate-card {
    width: min(560px, 100%);
    padding: 1.5rem;
    border-radius: 20px;
    background: #ffffff;
    border: 1px solid var(--border);
    box-shadow: 0 20px 44px rgba(15, 23, 42, 0.22);
    display: grid;
    gap: 1rem;
}

.install-instructions {
    min-height: 1.5rem;
    padding: 0.95rem 1rem;
    border-radius: 14px;
    background: rgba(31, 95, 139, 0.08);
    color: var(--text);
    line-height: 1.5;
}

.chat-shell {
    display: grid;
    gap: 1rem;
}

.chat-messages {
    min-height: 380px;
    max-height: 62vh;
    overflow: auto;
    padding: 1rem;
    border-radius: 18px;
    background: #f5f7fa;
    border: 1px solid rgba(31, 41, 55, 0.08);
    display: grid;
    gap: 0.85rem;
    align-content: start;
}

.chat-message {
    display: flex;
    justify-content: flex-start;
}

.chat-message.is-self {
    justify-content: flex-end;
}

.chat-bubble {
    max-width: min(680px, 100%);
    padding: 0.9rem 1rem;
    border-radius: 16px;
    background: #ffffff;
    border: 1px solid rgba(31, 41, 55, 0.08);
    box-shadow: 0 8px 18px rgba(15, 23, 42, 0.06);
    display: grid;
    gap: 0.45rem;
}

.chat-message.is-self .chat-bubble {
    background: #e8f1f7;
    border-color: rgba(31, 95, 139, 0.16);
}

.chat-bubble p {
    line-height: 1.5;
}

.chat-form {
    display: grid;
    gap: 0.8rem;
}

.notification-item {
    align-items: flex-start;
    border: 1px solid transparent;
}

.notification-item.is-unread {
    background: #edf5fb;
    border-color: rgba(31, 95, 139, 0.14);
}

.notification-item strong,
.chat-bubble strong {
    font-size: 0.95rem;
}

.notification-item p,
.chat-bubble p {
    margin: 0;
}

@media (max-width: 1100px) {
    .stats-grid,
    .card-grid.two-col,
    .hero-panel {
        grid-template-columns: 1fr;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        grid-template-rows: auto;
        border-right: 0;
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    }

    .nav-stack {
        grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    }
}

@media (max-width: 720px) {
    .workspace {
        padding: 1rem;
    }

    .header-meta {
        justify-content: stretch;
    }

    .header-link,
    .identity-card {
        width: 100%;
    }

    .workspace-header {
        flex-direction: column;
        align-items: stretch;
    }

    .form-grid,
    .card-grid.two-col {
        grid-template-columns: 1fr;
    }

    .form-grid .span-2 {
        grid-column: span 1;
    }

    .hero-copy,
    .auth-card,
    .card,
    .stat-card {
        padding: 1rem;
        border-radius: 20px;
    }

    .chat-messages {
        min-height: 300px;
        max-height: 50vh;
        padding: 0.85rem;
    }

    .app-gate {
        padding: 1rem;
    }

    .app-gate-card {
        padding: 1.2rem;
    }
}
