body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, sans-serif;
    background: linear-gradient(135deg, #f6f8fb, #eef4ea);
    color: #20313f;
    overflow-x: hidden;
}

.wrap {
    max-width: 980px;
    margin: 32px auto;
    padding: 0 16px;
}

.card {
    background: #fff;
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 18px 45px rgba(31, 53, 71, 0.08);
}

.card.app-shell {
    padding-top: 18px;
}

.section-card {
    margin-top: 22px;
    padding: 20px;
    border: 1px solid #e2e8f0;
    border-radius: 18px;
    background: linear-gradient(180deg, #ffffff, #fbfdff);
}

.section-card h2 {
    margin-bottom: 14px;
}

h1, h2 {
    margin-top: 0;
}

.muted {
    color: #64748b;
}

form {
    display: grid;
    gap: 16px;
}

.inline-form {
    display: block;
    margin-top: 10px;
}

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

#dashboard-filters.is-loading {
    opacity: 0.72;
    transition: opacity 0.15s ease;
}

label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
}

input, select, textarea, button {
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 11px 12px;
    font-size: 14px;
}

input[type="date"] {
    min-height: 48px;
    padding-right: 16px;
    cursor: pointer;
}

input[type="month"] {
    min-height: 48px;
    padding-right: 16px;
    cursor: pointer;
}

input[type="date"]::-webkit-calendar-picker-indicator {
    padding: 8px;
    margin-right: -4px;
    transform: scale(1.35);
    transform-origin: center;
    cursor: pointer;
}

input[type="month"]::-webkit-calendar-picker-indicator {
    padding: 8px;
    margin-right: -4px;
    transform: scale(1.35);
    transform-origin: center;
    cursor: pointer;
}

button,
.button {
    appearance: none;
    background: linear-gradient(135deg, #0f766e, #0f766e 55%, #115e59);
    color: #fff;
    border: 1px solid rgba(15, 118, 110, 0.22);
    cursor: pointer;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    gap: 8px;
    padding: 11px 16px;
    border-radius: 999px;
    font-weight: 700;
    letter-spacing: 0.01em;
    box-shadow: 0 10px 22px rgba(15, 118, 110, 0.16);
    transition: transform 0.16s ease, box-shadow 0.16s ease, background 0.16s ease, border-color 0.16s ease;
}

button:hover,
.button:hover {
    transform: translateY(-1px);
    box-shadow: 0 14px 26px rgba(15, 118, 110, 0.22);
}

.button.secondary {
    background: #ffffff;
    color: #1f2937;
    border-color: #dbe4ee;
    box-shadow: 0 10px 22px rgba(15, 23, 42, 0.08);
}

.button.secondary:hover {
    box-shadow: 0 14px 26px rgba(15, 23, 42, 0.12);
}

button:active,
.button:active {
    transform: translateY(0);
}

button:focus-visible,
.button:focus-visible {
    outline: 3px solid rgba(45, 212, 191, 0.28);
    outline-offset: 2px;
}

table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 20px;
}

th, td {
    padding: 10px 12px;
    border-bottom: 1px solid #e2e8f0;
    text-align: left;
    vertical-align: top;
}

th {
    background: #f8fafc;
}

.flash {
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 16px;
}

.flash.success {
    background: #dcfce7;
    color: #166534;
}

.flash.error {
    background: #fee2e2;
    color: #991b1b;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
    margin-bottom: 28px;
    padding: 24px 26px;
    border-radius: 24px;
    background:
        radial-gradient(circle at top left, rgba(148, 163, 184, 0.14), transparent 34%),
        radial-gradient(circle at bottom right, rgba(59, 130, 246, 0.12), transparent 28%),
        linear-gradient(135deg, #0f172a 0%, #13263f 46%, #1d4e89 100%);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.08);
    box-shadow: 0 22px 48px rgba(15, 23, 42, 0.18);
}

.topbar h1,
.topbar h2,
.topbar p,
.topbar .muted {
    color: inherit;
}

.topbar-copy {
    display: flex;
    align-items: flex-start;
    gap: 16px;
    min-width: 0;
}

.topbar-mark {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 21px;
    font-weight: 800;
    letter-spacing: 0.08em;
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.08));
    border: 1px solid rgba(255, 255, 255, 0.14);
    box-shadow:
        inset 0 1px 0 rgba(255, 255, 255, 0.1),
        0 10px 24px rgba(15, 23, 42, 0.16);
    flex: 0 0 auto;
}

.topbar-copy h1,
.topbar-copy h2 {
    margin: 0 0 4px;
    font-size: 28px;
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.05;
}

.topbar-copy p {
    margin: 0;
    max-width: 560px;
    font-size: 14px;
    line-height: 1.55;
    color: rgba(248, 250, 252, 0.78);
}

.topbar-meta {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-top: 14px;
    padding: 8px 14px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(248, 250, 252, 0.92);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.02em;
}

.topbar-actions {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    justify-content: flex-end;
    flex: 1 1 auto;
    min-width: 260px;
}

.actions {
    display: inline-flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
    padding: 8px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.topbar .button,
.topbar .button.secondary {
    width: auto;
    min-width: 112px;
    padding: 10px 16px;
    background: rgba(255, 255, 255, 0.08);
    color: #f8fafc;
    border: 1px solid rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
    font-size: 13px;
    font-weight: 700;
}

.topbar .button:hover,
.topbar .button.secondary:hover {
    background: rgba(255, 255, 255, 0.16);
    transform: translateY(-1px);
}

.topbar .button {
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.9), rgba(29, 78, 216, 0.92));
    border-color: rgba(147, 197, 253, 0.22);
    box-shadow: 0 10px 22px rgba(29, 78, 216, 0.22);
}

.topbar .button:hover {
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.96), rgba(37, 99, 235, 0.96));
}

.dates-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 12px;
}

.date-badges {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.date-badge {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    border-radius: 999px;
    background: linear-gradient(135deg, #e6fffa, #ecfccb);
    border: 1px solid #99f6e4;
    color: #134e4a;
    font-weight: 600;
    white-space: nowrap;
}

.date-badge .weekday {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 42px;
    padding: 4px 8px;
    border-radius: 999px;
    background: #115e59;
    color: #f0fdfa;
    font-size: 12px;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.date-badge.large {
    padding: 10px 14px;
    background: linear-gradient(135deg, #eff6ff, #ecfeff);
    border-color: #bfdbfe;
    color: #1e3a8a;
}

.date-badge.large .weekday {
    background: #1d4ed8;
    color: #eff6ff;
}

.empty-state {
    color: #64748b;
    font-style: italic;
}

.week-sections {
    display: grid;
    gap: 16px;
}

.week-card {
    border: 1px solid #dbeafe;
    border-radius: 18px;
    padding: 18px;
    background: linear-gradient(135deg, #f8fbff, #f0fdfa);
}

.week-card h3 {
    margin: 0 0 4px;
    font-size: 18px;
}

.week-card .week-range {
    color: #64748b;
    margin-bottom: 14px;
}

.week-card.submitted {
    border-color: #86efac;
    background: linear-gradient(135deg, #f0fdf4, #ecfeff);
}

.week-card.pending {
    border-color: #bfdbfe;
}

.week-meta {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    align-items: center;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.status-pill {
    display: inline-flex;
    align-items: center;
    padding: 6px 10px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.status-pill.submitted,
.status-pill.approved {
    background: #dcfce7;
    color: #166534;
}

.status-pill.pending {
    background: #dbeafe;
    color: #1d4ed8;
}

.multi-select {
    min-height: 152px;
}

.stack-note {
    margin-top: 8px;
    font-size: 12px;
}

.leader-stack {
    display: grid;
    gap: 10px;
}

.leader-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
}

.leader-row .button {
    width: auto;
    min-width: 94px;
}

.leader-actions {
    display: flex;
    justify-content: flex-start;
    margin-top: 10px;
}

.leader-actions .button {
    width: auto;
}

.manage-form {
    display: grid;
    gap: 12px;
    min-width: 0;
}

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

.compact-field label {
    font-size: 12px;
    margin-bottom: 4px;
    color: #64748b;
}

.inline-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
}

.inline-actions .button,
.inline-actions button {
    width: auto;
    min-width: 110px;
}

.field-footer {
    display: flex;
    align-items: flex-end;
}

#month-filter-form {
    align-items: end;
}

.label-with-tip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.tip-trigger {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 999px;
    background: #e2e8f0;
    color: #334155;
    font-size: 12px;
    font-weight: 700;
    cursor: help;
}

.tip-trigger::after {
    content: attr(data-tip);
    position: absolute;
    left: 50%;
    bottom: calc(100% + 10px);
    transform: translateX(-50%);
    min-width: 220px;
    max-width: 280px;
    padding: 10px 12px;
    border-radius: 12px;
    background: #0f172a;
    color: #f8fafc;
    font-size: 12px;
    font-weight: 500;
    line-height: 1.45;
    box-shadow: 0 12px 28px rgba(15, 23, 42, 0.24);
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.16s ease, transform 0.16s ease;
    z-index: 20;
}

.tip-trigger:hover::after,
.tip-trigger:focus-visible::after {
    opacity: 1;
    transform: translateX(-50%) translateY(-2px);
}

.table-wrap {
    overflow-x: auto;
    margin-top: 18px;
}

.responsive-table {
    margin-top: 0;
}

#users-filters.is-loading,
#users-rows.is-loading {
    opacity: 0.72;
    transition: opacity 0.15s ease;
}

@media (max-width: 760px) {
    .wrap {
        margin: 18px auto;
        padding: 0 12px;
        max-width: 100%;
    }

    .card {
        padding: 18px;
        border-radius: 18px;
    }

    .section-card {
        padding: 16px;
        border-radius: 16px;
    }

    .topbar {
        flex-direction: column;
        align-items: stretch;
        padding: 20px;
    }

    .topbar-actions {
        align-items: stretch;
        min-width: 0;
    }

    .actions {
        justify-content: stretch;
        width: 100%;
    }

    .topbar-copy {
        gap: 12px;
    }

    .topbar-copy h1,
    .topbar-copy h2 {
        font-size: 24px;
    }

    .topbar-copy p {
        max-width: none;
    }

    .topbar .button,
    .topbar .button.secondary {
        width: 100%;
        min-width: 0;
    }

    .date-badge,
    .date-badge.large {
        white-space: normal;
    }

    .leader-row {
        grid-template-columns: 1fr;
    }

    .leader-row .button,
    .leader-actions .button {
        width: 100%;
    }

    .field-footer {
        align-items: stretch;
    }

    .field-footer button {
        width: 100%;
    }

    .manage-grid {
        grid-template-columns: 1fr;
    }

    .inline-actions .button,
    .inline-actions button {
        width: 100%;
    }

    .tip-trigger::after {
        left: 0;
        transform: translateX(0);
    }

    .tip-trigger:hover::after,
    .tip-trigger:focus-visible::after {
        transform: translateX(0) translateY(-2px);
    }

    .responsive-table thead {
        display: none;
    }

    .responsive-table,
    .responsive-table tbody,
    .responsive-table tr,
    .responsive-table td {
        display: block;
        width: 100%;
    }

    .responsive-table tr {
        padding: 14px 0;
        border-bottom: 1px solid #e2e8f0;
    }

    .responsive-table td {
        border: 0;
        padding: 8px 0;
    }

    .responsive-table td::before {
        content: attr(data-label);
        display: block;
        margin-bottom: 4px;
        color: #64748b;
        font-size: 12px;
        font-weight: 700;
        letter-spacing: 0.03em;
        text-transform: uppercase;
    }

    .responsive-table td[colspan] {
        padding: 12px 0;
    }

    .responsive-table td[colspan]::before {
        display: none;
    }

    .responsive-table td:last-child {
        padding-bottom: 0;
    }

    .table-wrap {
        overflow-x: visible;
    }

    .date-badges {
        gap: 8px;
    }

    .date-badge,
    .date-badge.large {
        width: 100%;
        justify-content: space-between;
    }

    .week-card {
        padding: 16px;
    }

    .week-meta {
        align-items: flex-start;
    }
}

@media (max-width: 480px) {
    .card {
        padding: 14px;
    }

    .topbar {
        padding: 16px;
        border-radius: 20px;
    }

    .topbar-copy {
        flex-direction: column;
    }

    .topbar-mark {
        width: 48px;
        height: 48px;
        border-radius: 16px;
        font-size: 19px;
    }

    .topbar-copy h1,
    .topbar-copy h2 {
        font-size: 20px;
    }

    .topbar-meta {
        display: flex;
        flex-wrap: wrap;
        gap: 6px;
        line-height: 1.35;
    }

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