/* ============================================================
   Stinkin Budz - Employee portal styles
   ============================================================ */

:root {
    --pine: #2d5047;
    --pine-dark: #1f3a33;
    --pine-darker: #162924;
    --olive: #9ba55d;
    --jade: #409e7c;
    --jade-light: #5cb896;
    --mist: #cdcfce;
    --ink: #212a27;
    --paper: #f6f7f6;
    --white: #ffffff;
    --radius: 14px;
    --shadow: 0 8px 24px rgba(31, 58, 51, 0.1);
    --font: 'Poppins', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--paper);
    color: var(--ink);
    line-height: 1.55;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.portal-container { width: min(1140px, 94%); margin: 0 auto; }
.portal-main { flex: 1; padding: 2rem 0 3rem; }
.muted { color: #6b7672; font-size: 0.9rem; }

/* ---------------- Buttons & forms ---------------- */
.portal-btn {
    display: inline-block;
    padding: 0.55rem 1.2rem;
    border-radius: 999px;
    border: 2px solid transparent;
    font-family: var(--font);
    font-weight: 600;
    font-size: 0.9rem;
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.12s ease, box-shadow 0.12s ease;
    background: none;
}
.portal-btn:hover { transform: translateY(-1px); }
.portal-btn-primary {
    background: linear-gradient(135deg, var(--jade-light), var(--jade) 60%, #35876a);
    color: var(--white);
    box-shadow: 0 4px 14px rgba(64, 158, 124, 0.3);
}
.portal-btn-ghost { border-color: var(--jade); color: var(--pine); }
.portal-btn-danger { background: #b04a3c; color: var(--white); }
.portal-btn-small { padding: 0.35rem 0.8rem; font-size: 0.8rem; }
.portal-btn-block { width: 100%; }

.portal-form-group { margin-bottom: 1rem; }
.portal-form-group label {
    display: block;
    font-weight: 600;
    color: var(--pine);
    font-size: 0.85rem;
    margin-bottom: 0.3rem;
}
.portal-form-group input,
.portal-form-group select {
    width: 100%;
    padding: 0.6rem 0.8rem;
    border: 2px solid var(--mist);
    border-radius: 10px;
    background: var(--white);
    font-family: var(--font);
    font-size: 0.92rem;
    transition: border-color 0.12s ease;
}
.portal-form-group input:focus,
.portal-form-group select:focus {
    outline: none;
    border-color: var(--jade);
}

.portal-flash {
    padding: 0.85rem 1.2rem;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.92rem;
    margin-bottom: 1.4rem;
}
.portal-flash-success { background: #e2f2ea; color: #1e5c44; border: 1px solid var(--jade); }
.portal-flash-error { background: #f7e6e4; color: #8c3327; border: 1px solid #cf7a6d; }

/* ---------------- Login page ---------------- */
.login-body {
    align-items: center;
    justify-content: center;
    background:
        radial-gradient(900px 500px at 80% -10%, rgba(64, 158, 124, 0.35), transparent 60%),
        radial-gradient(700px 400px at 0% 110%, rgba(155, 165, 93, 0.25), transparent 60%),
        linear-gradient(160deg, var(--pine) 0%, var(--pine-dark) 60%, var(--pine-darker) 100%);
    padding: 1rem;
}
.login-card {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: 0 20px 50px rgba(22, 41, 36, 0.4);
    padding: 2.5rem 2.2rem;
    width: min(420px, 100%);
    text-align: center;
}
.login-logo { height: 72px; margin-bottom: 1rem; }
.login-card h1 { color: var(--pine); font-size: 1.5rem; margin-bottom: 0.2rem; }
.login-sub { color: #6b7672; font-size: 0.92rem; margin-bottom: 1.5rem; }
.login-card form { text-align: left; }
.login-help { margin-top: 1.4rem; font-size: 0.82rem; color: #6b7672; }
.login-back { margin-top: 0.5rem; font-size: 0.82rem; }
.login-back a { color: var(--jade); text-decoration: none; font-weight: 600; }
.login-back a:hover { text-decoration: underline; }

/* ---------------- Portal header ---------------- */
.portal-header {
    background: var(--pine);
    box-shadow: 0 2px 10px rgba(22, 41, 36, 0.3);
}
.portal-header-inner {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.75rem 0;
}
.portal-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: var(--white);
    font-weight: 700;
    font-size: 1.05rem;
    white-space: nowrap;
}
.portal-brand img { height: 34px; }
.portal-brand b { color: var(--olive); }
.portal-brand em {
    font-style: normal;
    font-weight: 500;
    color: var(--mist);
    font-size: 0.8rem;
    margin-left: 0.3rem;
}

.portal-nav { display: flex; gap: 0.4rem; flex: 1; }
.portal-nav a {
    color: var(--mist);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.88rem;
    padding: 0.45rem 0.9rem;
    border-radius: 999px;
    transition: background 0.12s ease, color 0.12s ease;
}
.portal-nav a:hover { color: var(--white); background: rgba(255, 255, 255, 0.08); }
.portal-nav a.active { color: var(--white); background: var(--jade); }

.portal-user { display: flex; align-items: center; gap: 1rem; }
.portal-user-name {
    color: var(--white);
    font-size: 0.85rem;
    font-weight: 600;
    text-align: right;
    line-height: 1.2;
}
.portal-user-name small {
    display: block;
    color: var(--olive);
    font-weight: 500;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.portal-logout {
    color: var(--mist);
    font-size: 0.85rem;
    text-decoration: none;
    border: 1px solid rgba(205, 207, 206, 0.4);
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
}
.portal-logout:hover { color: var(--white); border-color: var(--white); }

.portal-nav-toggle {
    display: none;
    background: none;
    border: 0;
    color: var(--white);
    font-size: 1.5rem;
    cursor: pointer;
}

/* ---------------- Page head / week nav ---------------- */
.page-head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.6rem;
}
.page-head h1 { color: var(--pine); font-size: 1.7rem; }
.page-sub { color: #6b7672; font-size: 0.92rem; }
.week-nav { display: flex; gap: 0.5rem; flex-wrap: wrap; }

/* ---------------- Panels ---------------- */
.panel {
    background: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 1.6rem;
    margin-bottom: 1.8rem;
}
.panel h2 { color: var(--pine); font-size: 1.15rem; margin-bottom: 1rem; }
.panel-narrow { max-width: 460px; }

.shift-form-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0 1.2rem;
}
.shift-form-actions { display: flex; gap: 0.7rem; align-items: center; }

/* ---------------- Hours panel ---------------- */
.hour-tiles {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 0.8rem;
    margin: 0.6rem 0 1.2rem;
}
.tile {
    border: 1px solid #e2e5e3;
    border-radius: 10px;
    padding: 0.75rem 0.9rem;
    background: var(--paper);
}
.tile-v {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--pine);
    line-height: 1.15;
    font-variant-numeric: tabular-nums;
}
.tile-v small { font-size: 0.85rem; font-weight: 700; color: #6b7672; }
.tile-k {
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #6b7672;
    margin-top: 0.15rem;
}
.week-bars { display: grid; gap: 0.45rem; max-width: 620px; margin-bottom: 0.8rem; }
.week-bar-row {
    display: grid;
    grid-template-columns: 6.8rem 1fr 4.6rem;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.78rem;
}
.wb-label { color: #6b7672; font-weight: 600; white-space: nowrap; font-variant-numeric: tabular-nums; }
.wb-track { position: relative; height: 12px; }
.wb-bar {
    position: absolute;
    inset: 0 auto 0 0;
    background: var(--jade);
    border-radius: 0 4px 4px 0;
    min-width: 2px;
}
.wb-bar.wb-zero { background: var(--mist); width: 2px !important; }
.week-bar-row:hover .wb-bar { background: var(--pine); }
.wb-value { font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }

/* ---------------- Month calendar ---------------- */
.cal-scroll { overflow-x: auto; }
.cal-grid {
    display: grid;
    grid-template-columns: 4.6rem repeat(7, minmax(112px, 1fr));
    gap: 4px;
    min-width: 940px;
    font-variant-numeric: tabular-nums;
}
.cal-dow {
    font-size: 0.66rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: #6b7672;
    padding: 0.25rem 0.4rem;
}
.cal-wkband {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.1rem;
    border-radius: 10px;
    padding: 0.4rem 0.5rem;
    background: #f2f4e8;
    border: 1px solid #e2e5e3;
    font-size: 0.6rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #6b7672;
}
.cal-wkband b { color: var(--ink); font-size: 0.76rem; letter-spacing: 0; text-transform: none; }
.cal-day {
    background: var(--paper);
    border: 1px solid #e2e5e3;
    border-radius: 10px;
    padding: 0.4rem 0.45rem;
    display: flex;
    flex-direction: column;
    gap: 0.22rem;
    min-height: 104px;
}
.cal-day.cal-dim { opacity: 0.42; }
.cal-day.cal-today { outline: 2px solid var(--jade); }
.cal-day.cal-warned { border-color: #b04a3c; }
.cal-day.cal-edited { border-color: #b98a2f; }
.cal-dnum {
    font-size: 0.75rem;
    font-weight: 700;
    color: #6b7672;
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.cal-dnum a { color: var(--jade); text-decoration: none; }
.cal-dnum a:hover { text-decoration: underline; }
.cal-flag-warn { color: #b04a3c; font-size: 0.62rem; }
.cal-flag-edit { color: #b98a2f; font-size: 0.62rem; }
.cal-slot { font-size: 0.68rem; line-height: 1.35; }
.cal-lbl {
    display: inline-block;
    width: 2.6rem;
    font-weight: 800;
    font-size: 0.58rem;
    letter-spacing: 0.5px;
    color: var(--jade);
    vertical-align: top;
}
.cal-lbl.cl { color: var(--pine); }
.cal-lbl.oc { color: #7d8549; }
.cal-mgr { font-weight: 800; }
.cal-mgr::after { content: " ★"; font-size: 0.62em; color: #7d8549; }
.cal-me { background: #f2f4e8; border-radius: 4px; padding: 0 0.22rem; font-weight: 700; }
.cal-gone { text-decoration: line-through; color: #9aa5a1; }
.cal-miss { color: #b04a3c; font-weight: 700; }
.cal-none { color: var(--mist); }
.cal-duty {
    display: block;
    background: #f2f4e8;
    border-left: 3px solid var(--olive);
    border-radius: 5px;
    padding: 0.12rem 0.4rem;
    font-size: 0.66rem;
    font-variant-numeric: tabular-nums;
}
.cal-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    font-size: 0.75rem;
    color: #6b7672;
    margin-top: 0.8rem;
}
.cal-legend span { display: inline-flex; align-items: center; gap: 0.35rem; }
.lg-duty, .lg-edit, .lg-warn { width: 0.7rem; height: 0.7rem; border-radius: 3px; display: inline-block; }
.lg-duty { background: var(--olive); }
.lg-edit { background: #b98a2f; }
.lg-warn { background: #b04a3c; }

/* ---------------- Day editor ---------------- */
.day-person {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
    border-bottom: 1px dashed #e2e5e3;
    font-size: 0.92rem;
}
.day-person-gone { color: #6b7672; }
.day-add-form { margin-top: 0.8rem; }
.duty-line {
    background: #f2f4e8;
    border-left: 3px solid var(--olive);
    border-radius: 6px;
    padding: 0.35rem 0.7rem;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
}

/* ---------------- Default Week editor ---------------- */
.tmpl-table td { min-width: 108px; }
.tmpl-chip-form { display: inline; }
.tmpl-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    background: #e2f2ea;
    border-radius: 999px;
    padding: 0.12rem 0.3rem 0.12rem 0.6rem;
    font-size: 0.74rem;
    font-weight: 600;
    margin: 0.1rem 0.15rem 0.1rem 0;
}
.tmpl-chip-mgr { background: var(--pine); color: var(--white); }
.tmpl-chip-gone { background: #f7e6e4; color: #8c3327; text-decoration: line-through; }
.tmpl-chip button {
    background: none;
    border: 0;
    color: inherit;
    opacity: 0.6;
    font-size: 0.9rem;
    line-height: 1;
    cursor: pointer;
    padding: 0 0.15rem;
}
.tmpl-chip button:hover { opacity: 1; }
.panel-subhead { color: var(--pine); font-size: 0.95rem; margin: 1.2rem 0 0.6rem; }
.rotation-form .shift-form-grid { grid-template-columns: repeat(4, 1fr); }
@media (max-width: 760px) {
    .rotation-form .shift-form-grid { grid-template-columns: 1fr; }
}

/* ---------------- Tables ---------------- */
.table-scroll { overflow-x: auto; }
.portal-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.portal-table th {
    text-align: left;
    color: var(--pine);
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    padding: 0.6rem 0.8rem;
    border-bottom: 2px solid var(--paper);
}
.portal-table td {
    padding: 0.7rem 0.8rem;
    border-bottom: 1px solid var(--paper);
    vertical-align: middle;
}
.row-inactive td { opacity: 0.55; }
.cell-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}
.inline-form { display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.inline-form input,
.inline-form select {
    padding: 0.42rem 0.7rem;
    border: 2px solid var(--mist);
    border-radius: 8px;
    font-family: var(--font);
    font-size: 0.82rem;
    background: var(--white);
    color: var(--ink);
}
.inline-form select { cursor: pointer; }
.inline-form input:focus,
.inline-form select:focus { outline: none; border-color: var(--jade); }
.inline-form input[type="password"] { width: 140px; }
.inline-form input[type="text"] { width: 230px; max-width: 100%; }

.tag {
    display: inline-block;
    padding: 0.1rem 0.6rem;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}
.tag-manager { background: var(--pine); color: var(--white); }
.tag-employee { background: var(--mist); color: var(--pine); }
.tag-you { background: var(--olive); color: var(--pine-darker); margin-left: 0.4rem; }

/* ---------------- Footer ---------------- */
.portal-footer {
    background: var(--pine-darker);
    color: var(--mist);
    padding: 1.2rem 0;
    font-size: 0.82rem;
}
.portal-footer a { color: var(--jade-light); text-decoration: none; }
.portal-footer a:hover { text-decoration: underline; }

/* ---------------- Responsive ---------------- */
@media (max-width: 1000px) {
    .week-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (max-width: 760px) {
    .portal-header-inner { flex-wrap: wrap; }
    .portal-nav-toggle { display: block; margin-left: auto; }
    .portal-nav {
        order: 10;
        flex-basis: 100%;
        flex-direction: column;
        display: none;
        padding-bottom: 0.6rem;
    }
    .portal-nav.open { display: flex; }
    .portal-user { margin-left: auto; }
    .week-grid { grid-template-columns: repeat(2, 1fr); }
    .shift-form-grid { grid-template-columns: 1fr; }
}
@media (max-width: 480px) {
    .week-grid { grid-template-columns: 1fr; }
    .day-column { min-height: 0; }
}