:root {
    --primary: #1f5eff;
    --dark: #0f172a;
    --sidebar: #111827;
    --light: #f5f7fb;
    --card: #ffffff;
    --muted: #64748b;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #f59e0b;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Arial, Helvetica, sans-serif; background: var(--light); color: var(--dark); }
.login-body { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at top left, #dbeafe, transparent 35%), linear-gradient(135deg, #0f172a, #1e3a8a); }
.login-card { width: 420px; background: white; border-radius: 22px; padding: 32px; box-shadow: 0 25px 70px rgba(0,0,0,.25); }
.logo-title { font-size: 30px; font-weight: 800; color: var(--primary); margin-bottom: 4px; }
.subtitle { color: var(--muted); margin-bottom: 25px; }
.form-group { margin-bottom: 16px; }
label { display: block; margin-bottom: 7px; font-weight: 700; font-size: 14px; }
input, select, textarea { width: 100%; padding: 12px 13px; border: 1px solid #cbd5e1; border-radius: 12px; font-size: 15px; }
textarea { min-height: 95px; }
.btn { border: none; padding: 11px 16px; border-radius: 12px; cursor: pointer; font-weight: 700; text-decoration: none; display: inline-block; }
.btn-primary { background: var(--primary); color: white; }
.btn-danger { background: var(--danger); color: white; }
.btn-success { background: var(--success); color: white; }
.btn-warning { background: var(--warning); color: white; }
.btn-light { background: #e2e8f0; color: #0f172a; }
.btn-sm { padding: 7px 10px; font-size: 13px; }
.alert { padding: 12px; border-radius: 12px; margin-bottom: 15px; }
.alert-danger { background: #fee2e2; color: #991b1b; }
.alert-success { background: #dcfce7; color: #166534; }
.alert-info { background: #dbeafe; color: #1e40af; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 260px; background: var(--sidebar); color: white; padding: 24px 18px; position: fixed; min-height: 100vh; }
.brand { font-size: 24px; font-weight: 800; margin-bottom: 30px; }
.nav a { display: block; color: #d1d5db; padding: 13px 14px; border-radius: 12px; text-decoration: none; margin-bottom: 8px; }
.nav a:hover, .nav a.active { background: rgba(255,255,255,.11); color: white; }
.main { margin-left: 260px; width: calc(100% - 260px); padding: 28px; }
.topbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 26px; }
.page-title h1 { margin: 0; font-size: 28px; }
.page-title p { margin: 6px 0 0; color: var(--muted); }
.card { background: var(--card); border-radius: 18px; padding: 22px; box-shadow: 0 10px 30px rgba(15,23,42,.07); margin-bottom: 20px; }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.stat { font-size: 30px; font-weight: 800; margin-top: 10px; }
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; color: #475569; font-size: 13px; border-bottom: 1px solid #e2e8f0; padding: 12px; }
.table td { border-bottom: 1px solid #e2e8f0; padding: 13px 12px; vertical-align: top; }
.badge { padding: 6px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; display:inline-block; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-gray { background: #e5e7eb; color: #374151; }
.badge-yellow { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-blue { background: #dbeafe; color: #1d4ed8; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.clock-panel { text-align: center; padding: 35px; background: linear-gradient(135deg, #ffffff, #eef4ff); border-radius: 22px; }
.clock-time { font-size: 42px; font-weight: 900; margin: 15px 0; }
.profile-header { display: flex; gap: 20px; align-items: center; }
.avatar { width: 86px; height: 86px; border-radius: 22px; background: #dbeafe; display: flex; align-items: center; justify-content: center; font-size: 32px; font-weight: 900; color: #1e40af; object-fit: cover; }
.info-line { margin-bottom: 10px; color: #334155; }
.info-line strong { color: #0f172a; }
.searchbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.searchbar input { max-width: 360px; }
.section-title { margin-top: 30px; border-top: 1px solid #e2e8f0; padding-top: 22px; }
.signature-pad { border: 2px dashed #94a3b8; border-radius: 14px; background: #fff; width: 100%; height: 190px; touch-action: none; }
.signature-preview { max-width: 260px; border: 1px solid #e2e8f0; border-radius: 10px; background: white; padding: 6px; }
.mar-card { border-left: 5px solid var(--primary); }
.due-now { border-left-color: var(--warning); }
.overdue { border-left-color: var(--danger); }
.administered { border-left-color: var(--success); }
.note-card { border-left: 5px solid var(--primary); }
.note-locked { border-left-color: var(--success); }
.note-pending { border-left-color: var(--warning); }
.print-area { background: white; }
@media print {
    .sidebar, .topbar, .actions, .btn { display:none !important; }
    .main { margin-left:0; width:100%; padding:0; }
    .card { box-shadow:none; border:1px solid #ddd; }
}
@media(max-width: 900px) {
    .sidebar { position: relative; width: 100%; min-height: auto; }
    .layout { display: block; }
    .main { margin-left: 0; width: 100%; }
    .grid, .grid-2, .grid-3, .form-row { grid-template-columns: 1fr; }
    .profile-header { align-items: flex-start; }
    .searchbar { display: block; }
    .searchbar input { max-width: 100%; margin-bottom: 10px; }
}

.task-card { border-left: 5px solid var(--primary); }
.task-pending { border-left-color: var(--warning); }
.task-completed { border-left-color: var(--success); }
.task-missed { border-left-color: var(--danger); }
.task-note { font-size: 14px; color: #475569; }

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, minmax(150px, 1fr));
    gap: 12px;
}
.calendar-day {
    background: #ffffff;
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    min-height: 220px;
    padding: 12px;
}
.calendar-day h3 {
    margin: 0 0 10px;
    font-size: 15px;
}
.shift-pill {
    display: block;
    border-radius: 12px;
    padding: 10px;
    margin-bottom: 9px;
    background: #eef2ff;
    border-left: 4px solid var(--primary);
    font-size: 13px;
    text-decoration: none;
    color: #0f172a;
}
.shift-pill strong { display:block; margin-bottom:3px; }
.shift-open { border-left-color: var(--warning); background: #fffbeb; }
.shift-filled { border-left-color: var(--success); background: #f0fdf4; }
.shift-cancelled { border-left-color: var(--danger); background: #fef2f2; }
@media(max-width: 1100px) {
    .calendar-grid { grid-template-columns: 1fr; }
    .calendar-day { min-height: auto; }
}

.incident-card { border-left: 5px solid var(--danger); }
.incident-open { border-left-color: var(--warning); }
.incident-reviewed { border-left-color: var(--success); }
.attachment-box {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 12px;
    margin-bottom: 10px;
    background: #f8fafc;
}

.permission-grid {
    display: grid;
    grid-template-columns: 1fr repeat(3, 90px);
    gap: 8px;
    align-items: center;
}
.permission-row {
    display: contents;
}
.permission-cell {
    padding: 10px;
    border-bottom: 1px solid #e2e8f0;
}
.access-denied-box {
    max-width: 620px;
    margin: 80px auto;
    background: white;
    padding: 32px;
    border-radius: 18px;
    box-shadow: 0 10px 30px rgba(15,23,42,.08);
}

/* Mobile Responsive Upgrade */
@media (max-width: 900px) {

    body {
        overflow-x: hidden;
    }

    .layout {
        display: block;
    }

    .sidebar {
        position: relative !important;
        width: 100% !important;
        height: auto !important;
        max-height: 260px;
        overflow-y: auto !important;
        padding: 18px !important;
    }

    .brand {
        font-size: 24px !important;
        margin-bottom: 12px !important;
    }

    .nav {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
        padding-bottom: 20px !important;
    }

    .nav a {
        font-size: 14px !important;
        padding: 10px !important;
        margin: 0 !important;
        border-radius: 10px;
        background: rgba(255,255,255,0.06);
    }

    .main {
        margin-left: 0 !important;
        padding: 18px !important;
        width: 100% !important;
    }

    .topbar {
        display: block !important;
        text-align: left !important;
    }

    .topbar > div:last-child {
        margin-top: 12px;
    }

    .grid,
    .grid-2,
    .grid-3,
    .calendar-grid {
        grid-template-columns: 1fr !important;
    }

    .card {
        padding: 18px !important;
        border-radius: 16px !important;
        overflow-x: auto;
    }

    .stat {
        font-size: 28px !important;
    }

    .form-row {
        display: block !important;
    }

    .form-group {
        width: 100% !important;
        margin-bottom: 14px !important;
    }

    input,
    select,
    textarea {
        width: 100% !important;
        font-size: 16px !important;
    }

    .searchbar {
        display: block !important;
    }

    .searchbar input,
    .searchbar select,
    .searchbar button,
    .searchbar a {
        width: 100% !important;
        margin-bottom: 10px !important;
    }

    .actions {
        display: block !important;
        width: 100%;
    }

    .actions a,
    .actions button,
    .btn {
        width: 100%;
        margin-bottom: 10px;
        text-align: center;
    }

    .table {
        min-width: 750px;
    }

    table {
        font-size: 14px;
    }

    .avatar {
        width: 75px !important;
        height: 75px !important;
        font-size: 28px !important;
    }
}

@media (max-width: 480px) {

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

    h1 {
        font-size: 28px !important;
    }

    h2 {
        font-size: 22px !important;
    }

    .card {
        padding: 14px !important;
    }

    .btn {
        font-size: 14px !important;
        padding: 12px !important;
    }
}

.sidebar {
    height: 100vh;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 40px;
}
.avatar{
width:110px;
height:110px;
overflow:hidden;
border-radius:18px;
background:#dbeafe;
}

.avatar img{
width:100%;
height:100%;
object-fit:cover;
display:block;
}

.avatar-fallback{
width:100%;
height:100%;

display:flex;

align-items:center;

justify-content:center;

font-size:34px;

font-weight:700;

color:#1d4ed8;

background:#dbeafe;
}
/* ======================================================
   APPOINTMENT CALENDAR — FINAL VERSION
====================================================== */

.calendar-grid{
    display:grid;
    grid-template-columns:repeat(7,minmax(180px,1fr));
    gap:14px;
}

.calendar-day{
    background:#fff;
    border:1px solid #e2e8f0;
    border-radius:18px;
    padding:14px;
    min-height:220px;
    display:flex;
    flex-direction:column;
    overflow:hidden;
}

.calendar-day h3{
    margin:0 0 12px;
    font-size:16px;
    font-weight:700;
    color:#0f172a;
}

.appointment-card{
    display:block !important;
    padding:12px !important;
    margin-top:8px !important;
    border-radius:14px !important;
    border-left:6px solid !important;
    text-decoration:none !important;
    font-size:13px !important;
    line-height:1.5 !important;
    transition:.18s;
    box-shadow:0 3px 10px rgba(0,0,0,.05);
    word-break:break-word;
}

.appointment-card:hover{
    transform:translateY(-2px);
    box-shadow:0 8px 18px rgba(0,0,0,.08);
}

.appointment-card *{
    color:inherit !important;
    text-decoration:none !important;
}

.appointment-card strong{
    display:block;
    font-size:16px;
    margin-bottom:6px;
}

.appointment-card.appt-upcoming{
    background:#dcfce7 !important;
    border-color:#16a34a !important;
    color:#166534 !important;
}

.appointment-card.appt-today{
    background:#fef3c7 !important;
    border-color:#f59e0b !important;
    color:#92400e !important;
}

.appointment-card.appt-past{
    background:#fee2e2 !important;
    border-color:#dc2626 !important;
    color:#991b1b !important;
}

.appointment-label{
    display:inline-block;
    margin-top:8px;
    padding:4px 10px;
    border-radius:999px;
    font-size:11px;
    font-weight:700;
    background:rgba(255,255,255,.75);
}

.calendar-actions{
    display:flex;
    gap:8px;
    margin-top:8px;
    flex-wrap:wrap;
}

.calendar-actions .btn{
    width:auto !important;
    margin:0 !important;
}

@media(max-width:1200px){
    .calendar-grid{
        grid-template-columns:repeat(4,1fr);
    }
}

@media(max-width:900px){
    .calendar-grid{
        grid-template-columns:repeat(2,1fr);
    }
}

@media(max-width:700px){
    .calendar-grid{
        grid-template-columns:1fr;
    }

    .calendar-day{
        min-height:auto;
    }
}

/* Keep appointment calendar inside the card */
.appointment-calendar-card {
    overflow-x: auto;
}

.appointment-calendar-card .calendar-grid {
    width: 100%;
    min-width: 0;
    grid-template-columns: repeat(7, minmax(130px, 1fr));
}

.appointment-calendar-card .calendar-day {
    min-width: 0;
}
/* =========================================================
   PERIDRA MODERN UI SYSTEM — 2026 REFRESH
   Global visual upgrade; business logic remains unchanged.
   ========================================================= */
:root {
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --primary-soft: #eff6ff;
    --secondary: #14b8a6;
    --dark: #0f172a;
    --sidebar: #0b1220;
    --light: #f4f7fb;
    --card: #ffffff;
    --muted: #64748b;
    --border: #e2e8f0;
    --danger: #dc2626;
    --success: #16a34a;
    --warning: #d97706;
    --info: #0284c7;
    --shadow-sm: 0 2px 8px rgba(15,23,42,.05);
    --shadow: 0 14px 35px rgba(15,23,42,.08);
    --shadow-lg: 0 24px 60px rgba(15,23,42,.13);
    --radius-sm: 10px;
    --radius: 16px;
    --radius-lg: 24px;
}

html { scroll-behavior: smooth; }
body {
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at 100% 0, rgba(37,99,235,.055), transparent 26rem),
        var(--light);
    color: #172033;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}
a { color: var(--primary); }
a:hover { color: var(--primary-dark); }

.layout { min-height: 100vh; }
.sidebar {
    width: 284px;
    height: 100vh;
    min-height: 0;
    padding: 0;
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    background:
        radial-gradient(circle at 15% 0, rgba(59,130,246,.22), transparent 17rem),
        linear-gradient(180deg, #101a2f 0%, #0b1220 55%, #070c16 100%);
    border-right: 1px solid rgba(255,255,255,.06);
    box-shadow: 18px 0 48px rgba(15,23,42,.10);
}
.sidebar-head { display:flex; align-items:center; justify-content:space-between; padding: 22px 20px 18px; }
.brand { display:flex; align-items:center; gap:12px; margin:0; color:#fff; text-decoration:none; }
.brand:hover { color:#fff; }
.brand-mark {
    width: 42px; height: 42px; border-radius: 14px; display:grid; place-items:center;
    font-size:22px; font-weight:900; color:white;
    background: linear-gradient(135deg, #3b82f6, #14b8a6);
    box-shadow: 0 10px 22px rgba(37,99,235,.35);
}
.brand-copy { display:flex; flex-direction:column; line-height:1.15; }
.brand-copy strong { font-size:20px; letter-spacing:-.4px; }
.brand-copy small { margin-top:4px; font-size:10px; letter-spacing:1.15px; color:#94a3b8; text-transform:uppercase; }
.sidebar-close { display:none; border:0; background:rgba(255,255,255,.08); color:#fff; width:36px; height:36px; border-radius:11px; font-size:24px; cursor:pointer; }
.nav { flex:1; overflow-y:auto; padding: 0 14px 22px; scrollbar-width:thin; scrollbar-color:rgba(255,255,255,.18) transparent; }
.nav-section { padding: 18px 12px 8px; color:#64748b; font-size:10px; font-weight:800; letter-spacing:1.25px; text-transform:uppercase; }
.nav a, .sidebar-footer a {
    position:relative; display:flex; align-items:center; gap:12px; margin:3px 0; padding:11px 12px;
    color:#cbd5e1; border-radius:12px; font-size:14px; font-weight:650; text-decoration:none;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}
.nav a:hover, .sidebar-footer a:hover { background:rgba(255,255,255,.075); color:#fff; transform:translateX(2px); }
.nav a.active { color:#fff; background:linear-gradient(90deg, rgba(37,99,235,.30), rgba(20,184,166,.12)); box-shadow:inset 3px 0 #60a5fa; }
.nav-icon { width:27px; height:27px; flex:0 0 27px; display:grid; place-items:center; border-radius:8px; background:rgba(255,255,255,.07); font-size:15px; color:#bfdbfe; }
.nav a.active .nav-icon { background:linear-gradient(135deg,#3b82f6,#14b8a6); color:#fff; }
.sidebar-footer { padding:14px; border-top:1px solid rgba(255,255,255,.08); }
.sidebar-overlay { display:none; }

.main { margin-left:284px; width:calc(100% - 284px); min-height:100vh; padding:30px clamp(22px, 3vw, 42px) 50px; }
.topbar {
    display:flex; justify-content:space-between; align-items:center; gap:24px; margin:0 0 28px;
    padding:0 0 22px; border-bottom:1px solid rgba(148,163,184,.22);
}
.topbar-left { display:flex; align-items:center; gap:14px; min-width:0; }
.mobile-menu-btn { display:none; border:1px solid var(--border); background:#fff; color:#0f172a; width:44px; height:44px; border-radius:13px; box-shadow:var(--shadow-sm); cursor:pointer; font-size:20px; }
.page-title .eyebrow { margin-bottom:3px; color:var(--primary); font-size:11px; font-weight:850; letter-spacing:1.3px; text-transform:uppercase; }
.page-title h1 { margin:0; color:#0f172a; font-size:clamp(26px, 3vw, 36px); line-height:1.16; letter-spacing:-.9px; }
.page-title p { margin:7px 0 0; color:var(--muted); font-size:14px; }
.user-panel { max-width:420px; display:flex; align-items:center; gap:12px; padding:10px 13px; border:1px solid rgba(226,232,240,.9); border-radius:16px; background:rgba(255,255,255,.82); box-shadow:var(--shadow-sm); backdrop-filter:blur(10px); }
.user-avatar { width:42px; height:42px; flex:0 0 42px; display:grid; place-items:center; border-radius:13px; color:#fff; font-size:13px; font-weight:850; background:linear-gradient(135deg,#2563eb,#14b8a6); }
.user-copy { min-width:0; display:flex; flex-direction:column; line-height:1.25; }
.user-copy strong { color:#0f172a; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-copy span, .user-copy small { color:#64748b; font-size:11px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-copy small { margin-top:3px; color:#2563eb; }

.card, .clock-panel, .access-denied-box {
    background:rgba(255,255,255,.97);
    border:1px solid rgba(226,232,240,.88);
    border-radius:var(--radius-lg);
    box-shadow:var(--shadow);
}
.card { padding:clamp(20px, 2.4vw, 30px); margin-bottom:22px; transition:transform .2s ease, box-shadow .2s ease; }
.card:hover { box-shadow:0 18px 42px rgba(15,23,42,.10); }
.card > h2:first-child, .card > h3:first-child { margin-top:0; color:#0f172a; letter-spacing:-.35px; }
.card > p:first-child { margin-top:0; }
.section-title { margin-top:34px; padding-top:26px; border-top:1px solid var(--border); color:#0f172a; }

.grid, .grid-2, .grid-3 { gap:20px; }
.grid > .card, .grid-2 > .card, .grid-3 > .card { height:100%; margin-bottom:0; }
.grid > .card { position:relative; overflow:hidden; }
.grid > .card::after { content:""; position:absolute; width:90px; height:90px; right:-28px; top:-28px; border-radius:50%; background:linear-gradient(135deg,rgba(37,99,235,.14),rgba(20,184,166,.05)); }
.stat { margin-top:10px; color:#0f172a; font-size:36px; line-height:1; letter-spacing:-1px; }

label { margin-bottom:7px; color:#334155; font-size:13px; font-weight:750; }
input:not([type="checkbox"]):not([type="radio"]), select, textarea {
    width:100%; min-height:46px; padding:11px 13px;
    color:#0f172a; background:#fff; border:1px solid #cbd5e1; border-radius:12px;
    font:inherit; font-size:14px; outline:none;
    transition:border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
textarea { min-height:115px; resize:vertical; }
input:not([type="checkbox"]):not([type="radio"]):hover, select:hover, textarea:hover { border-color:#94a3b8; }
input:not([type="checkbox"]):not([type="radio"]):focus, select:focus, textarea:focus { border-color:#3b82f6; box-shadow:0 0 0 4px rgba(59,130,246,.13); }
input[type="checkbox"], input[type="radio"] { accent-color:var(--primary); }
.form-group { margin-bottom:18px; }
.form-row { gap:18px; }
small, .help-text { color:#64748b; }

.btn, button.btn, input[type="submit"] {
    min-height:42px; padding:10px 16px; border:1px solid transparent; border-radius:12px;
    font:inherit; font-size:13px; font-weight:780; line-height:1; text-decoration:none; cursor:pointer;
    display:inline-flex; align-items:center; justify-content:center; gap:7px;
    transition:transform .16s ease, box-shadow .16s ease, filter .16s ease, background .16s ease;
}
.btn:hover, input[type="submit"]:hover { transform:translateY(-1px); filter:brightness(.98); }
.btn:active, input[type="submit"]:active { transform:translateY(0); }
.btn-primary { color:#fff; background:linear-gradient(135deg,#2563eb,#1d4ed8); box-shadow:0 8px 18px rgba(37,99,235,.20); }
.btn-success { color:#fff; background:linear-gradient(135deg,#16a34a,#15803d); }
.btn-danger { color:#fff; background:linear-gradient(135deg,#dc2626,#b91c1c); }
.btn-warning { color:#fff; background:linear-gradient(135deg,#f59e0b,#d97706); }
.btn-light, .btn-secondary { color:#334155; background:#fff; border-color:#cbd5e1; box-shadow:var(--shadow-sm); }
.btn-sm { min-height:34px; padding:7px 11px; border-radius:10px; font-size:12px; }
.actions { gap:9px; align-items:center; }

.alert { border:1px solid transparent; border-radius:14px; padding:13px 15px; box-shadow:var(--shadow-sm); }
.alert-danger { background:#fff1f2; border-color:#fecdd3; color:#9f1239; }
.alert-success { background:#f0fdf4; border-color:#bbf7d0; color:#166534; }
.alert-info { background:#eff6ff; border-color:#bfdbfe; color:#1e40af; }
.alert-warning { background:#fffbeb; border-color:#fde68a; color:#92400e; }

.table-responsive, .card:has(> .table) { overflow-x:auto; }
.table { width:100%; border-collapse:separate; border-spacing:0; }
.table th { padding:13px 14px; color:#475569; background:#f8fafc; border-top:1px solid var(--border); border-bottom:1px solid var(--border); font-size:11px; font-weight:850; letter-spacing:.55px; text-transform:uppercase; white-space:nowrap; }
.table th:first-child { border-left:1px solid var(--border); border-radius:12px 0 0 12px; }
.table th:last-child { border-right:1px solid var(--border); border-radius:0 12px 12px 0; }
.table td { padding:14px; color:#334155; border-bottom:1px solid #edf1f6; vertical-align:middle; }
.table tbody tr { transition:background .15s ease; }
.table tbody tr:hover { background:#f8fbff; }
.table tbody tr:last-child td { border-bottom:0; }
table:not(.table) { width:100%; border-collapse:collapse; }
table:not(.table) th, table:not(.table) td { padding:12px; border-bottom:1px solid var(--border); text-align:left; }
table:not(.table) th { color:#475569; background:#f8fafc; font-size:12px; }

.badge { padding:6px 10px; border-radius:999px; font-size:11px; font-weight:800; letter-spacing:.15px; }
.badge-green { background:#dcfce7; color:#166534; }
.badge-gray { background:#eef2f7; color:#475569; }
.badge-yellow { background:#fef3c7; color:#92400e; }
.badge-red { background:#fee2e2; color:#991b1b; }
.badge-blue { background:#dbeafe; color:#1d4ed8; }

.profile-header { gap:22px; padding:4px 0; }
.avatar { width:92px; height:92px; border-radius:24px; background:linear-gradient(135deg,#dbeafe,#ccfbf1); color:#1d4ed8; border:4px solid #fff; box-shadow:0 10px 25px rgba(37,99,235,.15); }
.info-line { padding:7px 0; border-bottom:1px dashed #e2e8f0; }
.info-line:last-child { border-bottom:0; }
.searchbar { padding:16px; border:1px solid var(--border); border-radius:16px; background:#f8fafc; }
.searchbar input { background:#fff; }

.task-card, .mar-card, .note-card, .incident-card, .attachment-box, .calendar-day {
    border-top:1px solid var(--border); border-right:1px solid var(--border); border-bottom:1px solid var(--border);
    box-shadow:var(--shadow-sm);
}
.task-card, .mar-card, .note-card, .incident-card { transition:transform .18s ease, box-shadow .18s ease; }
.task-card:hover, .mar-card:hover, .note-card:hover, .incident-card:hover { transform:translateY(-2px); box-shadow:var(--shadow); }
.calendar-day { border-radius:18px; background:#fff; }
.shift-pill { border-radius:12px; box-shadow:0 4px 10px rgba(15,23,42,.05); }
.permission-grid { border:1px solid var(--border); border-radius:16px; overflow:hidden; background:#fff; }
.permission-cell { min-height:46px; display:flex; align-items:center; }

.login-body {
    position:relative; overflow:hidden; padding:24px;
    background:
        radial-gradient(circle at 15% 15%, rgba(59,130,246,.55), transparent 25rem),
        radial-gradient(circle at 85% 85%, rgba(20,184,166,.35), transparent 25rem),
        linear-gradient(135deg,#071020,#10244d 55%,#0c3840);
}
.login-body::before, .login-body::after { content:""; position:absolute; border:1px solid rgba(255,255,255,.08); border-radius:50%; }
.login-body::before { width:420px; height:420px; left:-150px; bottom:-170px; }
.login-body::after { width:520px; height:520px; right:-220px; top:-230px; }
.login-card { position:relative; z-index:1; width:min(440px,100%); padding:38px; border:1px solid rgba(255,255,255,.7); border-radius:28px; box-shadow:0 35px 90px rgba(0,0,0,.35); }
.logo-title { font-size:34px; letter-spacing:-1px; background:linear-gradient(135deg,#2563eb,#0f766e); -webkit-background-clip:text; background-clip:text; color:transparent; }
.subtitle { margin-bottom:28px; }
.login-card .btn { width:100%; min-height:48px; }

.clock-panel { padding:38px; }
.clock-time { color:#0f172a; letter-spacing:-1.5px; }
.signature-pad { border:2px dashed #93c5fd; background:linear-gradient(180deg,#fff,#f8fbff); }

@media (max-width: 1180px) {
    .grid { grid-template-columns:repeat(2,minmax(0,1fr)); }
    .user-panel { max-width:320px; }
}

@media (max-width: 900px) {
    .sidebar { position:fixed !important; width:284px !important; height:100vh !important; max-height:none !important; transform:translateX(-105%); transition:transform .25s ease; }
    body.nav-open .sidebar { transform:translateX(0); }
    .sidebar-close { display:grid; place-items:center; }
    .sidebar-overlay { position:fixed; inset:0; z-index:999; display:block; background:rgba(2,6,23,.55); opacity:0; pointer-events:none; transition:opacity .2s ease; backdrop-filter:blur(3px); }
    body.nav-open .sidebar-overlay { opacity:1; pointer-events:auto; }
    .nav { display:block !important; padding-bottom:20px !important; }
    .nav a { margin:3px 0 !important; padding:11px 12px !important; background:transparent !important; }
    .nav a.active { background:linear-gradient(90deg, rgba(37,99,235,.30), rgba(20,184,166,.12)) !important; }
    .main { margin-left:0 !important; width:100% !important; padding:22px 18px 40px !important; }
    .topbar { display:flex !important; text-align:left !important; align-items:flex-start; }
    .topbar > div:last-child { margin-top:0 !important; }
    .mobile-menu-btn { display:grid; place-items:center; flex:0 0 44px; }
    .user-panel { max-width:250px; }
    .user-copy span, .user-copy small { display:none; }
    .card { padding:20px !important; border-radius:20px !important; }
}

@media (max-width: 680px) {
    .topbar { gap:14px; }
    .page-title .eyebrow, .page-title p { display:none; }
    .page-title h1 { font-size:25px; }
    .user-panel { padding:6px; border:0; background:transparent; box-shadow:none; }
    .user-copy { display:none; }
    .grid, .grid-2, .grid-3, .form-row { grid-template-columns:1fr !important; }
    .actions .btn { flex:1 1 auto; }
    .searchbar { display:flex !important; flex-direction:column; align-items:stretch; }
    .searchbar > * { width:100%; max-width:none !important; }
    .profile-header { flex-direction:column; }
    .login-card { padding:28px 22px; border-radius:24px; }
}

@media print {
    body { background:#fff; }
    .sidebar, .sidebar-overlay, .topbar, .actions, .btn, .mobile-menu-btn { display:none !important; }
    .main { margin:0 !important; width:100% !important; padding:0 !important; }
    .card { box-shadow:none !important; border:1px solid #ddd !important; }
}
