/* 2CRSI Edge - minimal starting theme.
   Clean white layout, thin borders, orange accent (brief §11).
   This is a functional first pass, not the final polished design system. */

:root {
    --edge-orange: #ff6b1a;
    --edge-orange-dark: #e0570d;
    --edge-text: #1f2328;
    --edge-muted: #6b7280;
    --edge-border: #e2e5e9;
    --edge-bg: #f7f8fa;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    color: var(--edge-text);
    background: var(--edge-bg);
}

/* ---- Login page ---- */

.login-body {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--edge-bg);
}

.login-card {
    background: #fff;
    border: 1px solid var(--edge-border);
    border-radius: 8px;
    padding: 2.5rem;
    width: 320px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06);
}

.login-brand {
    text-align: center;
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.75rem;
}

.brand-2crsi {
    color: var(--edge-text);
}

.brand-edge {
    color: var(--edge-orange);
}

.login-field {
    margin-bottom: 1rem;
}

.login-field label {
    display: block;
    font-size: 0.85rem;
    color: var(--edge-muted);
    margin-bottom: 0.25rem;
}

.login-input {
    width: 100%;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--edge-border);
    border-radius: 6px;
    font-size: 1rem;
}

.login-input:focus {
    outline: none;
    border-color: var(--edge-orange);
}

.login-validation {
    color: #c0392b;
    font-size: 0.8rem;
}

.login-error {
    background: #fdecea;
    border: 1px solid #f5c6cb;
    color: #a4293a;
    padding: 0.6rem 0.75rem;
    border-radius: 6px;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.login-button {
    width: 100%;
    background: var(--edge-orange);
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.7rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 0.5rem;
}

.login-button:hover {
    background: var(--edge-orange-dark);
}

/* ---- Signed-in shell ---- */

.edge-topbar {
    background: var(--edge-orange);
    color: #fff;
    padding: 1rem 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.edge-topbar .edge-user {
    font-size: 0.9rem;
}

.edge-topbar form {
    display: inline;
}

.edge-topbar button {
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.4);
    color: #fff;
    border-radius: 6px;
    padding: 0.4rem 0.9rem;
    cursor: pointer;
}

.edge-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    padding: 1.5rem;
    max-width: 1000px;
    margin: 0 auto;
}

.edge-card {
    background: #fff;
    border: 1px solid var(--edge-border);
    border-radius: 8px;
    padding: 1.5rem;
    text-decoration: none;
    color: var(--edge-text);
    transition: box-shadow 0.15s;
}

.edge-card:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.edge-card-icon {
    font-size: 1.6rem;
    margin-bottom: 0.5rem;
}

.edge-card h3 {
    margin: 0 0 0.4rem 0;
    font-size: 1.05rem;
}

.edge-card p {
    margin: 0;
    color: var(--edge-muted);
    font-size: 0.85rem;
}

.role-nav {
    display: flex;
    gap: 0.75rem;
    padding: 0.75rem 1.5rem;
    background: #fff8f2;
    border-bottom: 1px solid var(--edge-border);
    font-size: 0.85rem;
}

.role-nav a {
    color: var(--edge-orange-dark);
    text-decoration: none;
    font-weight: 600;
}

.role-nav a:hover {
    text-decoration: underline;
}

/* ---- Leave calendar ---- */

.leave-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.5rem;
    border-bottom: 1px solid var(--edge-border);
    background: #fff;
}

.leave-header .home-btn {
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f2f2f2;
    border-radius: 8px;
    text-decoration: none;
    color: var(--edge-text);
    font-size: 1.2rem;
}

.leave-header .leave-tabs {
    display: flex;
    gap: 2rem;
}

.leave-header .leave-tabs a {
    text-decoration: none;
    color: var(--edge-muted);
    font-weight: 400;
    padding-bottom: 0.5rem;
    border-bottom: 2px solid transparent;
}

.leave-header .leave-tabs a.active {
    color: var(--edge-text);
    font-weight: 700;
    border-bottom-color: var(--edge-orange);
}

.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    max-width: 1100px;
    margin: 0 auto;
}

.cal-nav a {
    text-decoration: none;
    color: var(--edge-text);
    font-weight: 600;
}

.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1.5rem;
}

.cal-day-header {
    text-align: center;
    color: var(--edge-muted);
    font-size: 0.85rem;
    padding-bottom: 0.4rem;
}

.cal-day {
    aspect-ratio: 1.4;
    border-radius: 6px;
    border: 1px solid var(--edge-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    cursor: pointer;
    position: relative;
}

.cal-day.cal-today {
    outline: 2px solid var(--edge-text);
    outline-offset: -2px;
}

.cal-working { background: #fff; color: var(--edge-text); }
.cal-nonworking { background: #d9d9d9; color: #6b6b6b; cursor: default; }
.cal-outside { background: #f2f2f2; color: #c2c2c2; cursor: default; }
.cal-pending { background: var(--edge-orange); color: #fff; }
.cal-approved { background: #3f9142; color: #fff; }

.cal-legend {
    display: flex;
    gap: 1.5rem;
    align-items: center;
    max-width: 1100px;
    margin: 1.5rem auto 0;
    padding: 0 1.5rem;
    font-size: 0.85rem;
}

.cal-legend .swatch {
    display: inline-block;
    width: 14px;
    height: 14px;
    border-radius: 3px;
    margin-right: 0.4rem;
    vertical-align: middle;
    border: 1px solid var(--edge-border);
}

.cal-dialog {
    border: none;
    border-radius: 10px;
    padding: 1.5rem;
    max-width: 360px;
    box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}

.cal-dialog::backdrop {
    background: rgba(0,0,0,0.4);
}

.mgr-day {
    background: #3f9142;
}
.mgr-day.mgr-pending { background: var(--edge-orange); }
.mgr-day.mgr-approved { background: #c0392b; }
.mgr-day.mgr-clear { background: #3f9142; }

/* ---- App shell (everything except the login/change-pin single-card
   pages) - plain block flow, NOT flex-centered like .login-body, since
   these pages have multiple stacked sections (topbar, cards, etc.) that
   must stack vertically, not squeeze into one flex row. ---- */

.app-body {
    margin: 0;
    background: var(--edge-bg);
    min-height: 100vh;
}

/* ---- Leave calendar (redesigned) ---- */

.leave-page {
    max-width: 1040px;
    margin: 0 auto;
    padding: 2rem 1.5rem 3rem;
}

.calendar-card {
    background: #fff;
    border: 1px solid var(--edge-border);
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
    padding: 1.75rem;
}

.cal-nav-v2 {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.5rem;
}

.cal-nav-v2 h2 {
    margin: 0;
    font-size: 1.3rem;
}

.cal-nav-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    text-decoration: none;
    color: var(--edge-text);
    font-weight: 600;
    font-size: 0.9rem;
    padding: 0.5rem 0.9rem;
    border: 1px solid var(--edge-border);
    border-radius: 8px;
    background: #fafafa;
}

.cal-nav-btn:hover {
    background: #f0f0f0;
}

.cal-grid-v2 {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 8px;
}

.cal-day-header-v2 {
    text-align: center;
    color: var(--edge-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    padding-bottom: 0.5rem;
}

.cal-day-v2 {
    aspect-ratio: 1.15;
    border-radius: 8px;
    border: 1px solid var(--edge-border);
    display: flex;
    align-items: flex-start;
    justify-content: flex-start;
    padding: 0.5rem;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: transform 0.1s ease, box-shadow 0.1s ease;
}

.cal-day-v2:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.cal-day-v2.cal-today {
    outline: 2px solid var(--edge-text);
    outline-offset: -2px;
}

.cal-working-v2 { background: #fff; color: var(--edge-text); }
.cal-nonworking-v2 { background: #e4e4e4; color: #8a8a8a; cursor: default; }
.cal-outside-v2 { background: #f6f6f6; color: #cfcfcf; cursor: default; border-color: #f0f0f0; }
.cal-pending-v2 { background: var(--edge-orange); color: #fff; border-color: var(--edge-orange); }
.cal-approved-v2 { background: #3f9142; color: #fff; border-color: #3f9142; }

.cal-legend-v2 {
    display: flex;
    flex-wrap: wrap;
    gap: 1.5rem;
    align-items: center;
    margin-top: 1.5rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--edge-border);
    font-size: 0.85rem;
    color: var(--edge-text);
}

.kpi-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
    gap: 1rem;
    margin-top: 1.5rem;
}

.kpi-card {
    background: #fff;
    border: 1px solid var(--edge-border);
    border-radius: 12px;
    padding: 1.25rem;
    display: flex;
    align-items: center;
    gap: 0.9rem;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.kpi-card .kpi-icon {
    width: 40px;
    height: 40px;
    border-radius: 10px;
    background: #fff3ea;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
}

.kpi-card .kpi-label {
    font-size: 0.78rem;
    color: var(--edge-muted);
    margin: 0 0 0.15rem;
}

.kpi-card .kpi-value {
    font-size: 1.15rem;
    font-weight: 700;
    margin: 0;
}

.mgr-clear-v2 { background: #3f9142; color: #fff; border-color: #3f9142; }
.mgr-pending-v2 { background: var(--edge-orange); color: #fff; border-color: var(--edge-orange); }
.mgr-approved-v2 { background: #c0392b; color: #fff; border-color: #c0392b; }
