/* =====================================================
   BẾP NHÀ v2 - Dark mode + Mobile optimized
   ===================================================== */

:root {
    --bg: #faf8f5;
    --bg-card: #ffffff;
    --bg-soft: #f5f1ec;
    --bg-hover: #ebe5db;
    --ink: #1a1a1a;
    --ink-soft: #4a4a4a;
    --ink-muted: #8b8680;
    --accent: #c14e2c;
    --accent-dark: #9a3d20;
    --accent-soft: #fde8df;
    --gold: #b88947;
    --green: #4a7c59;
    --green-soft: #e3f0e7;
    --red: #c0392b;
    --red-soft: #fbe4e0;
    --yellow: #d4a437;
    --yellow-soft: #fff4d6;
    --blue: #3a6b8a;
    --blue-soft: #e1ecf3;
    --border: #e8e2d8;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 4px 16px rgba(60,40,20,0.06);
    --shadow-lg: 0 12px 40px rgba(60,40,20,0.10);
    --radius: 14px;
    --radius-sm: 8px;
    --sidebar-bg: linear-gradient(180deg, #2c1810 0%, #1a0f08 100%);
    --sidebar-text: #f5f1ec;
    --weekend-bg: #b5e5ee;
}

[data-theme="dark"] {
    --bg: #14110e;
    --bg-card: #1f1a16;
    --bg-soft: #28221c;
    --bg-hover: #332b23;
    --ink: #f5f1ec;
    --ink-soft: #c8c0b3;
    --ink-muted: #8b8580;
    --accent: #e87151;
    --accent-dark: #c14e2c;
    --accent-soft: #3d2419;
    --green: #6b9c7a;
    --green-soft: #1f3025;
    --red: #e15648;
    --red-soft: #3d1f1a;
    --yellow: #e8b94a;
    --yellow-soft: #3d3018;
    --blue: #5d96b5;
    --blue-soft: #1a2a36;
    --border: #3a322a;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.3);
    --shadow: 0 4px 16px rgba(0,0,0,0.4);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.6);
    --sidebar-bg: linear-gradient(180deg, #0a0805 0%, #050302 100%);
    --weekend-bg: #1d3540;
}

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

html, body {
    font-family: 'Be Vietnam Pro', -apple-system, sans-serif;
    background: var(--bg);
    color: var(--ink);
    font-size: 14px;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
    transition: background 0.3s, color 0.3s;
}

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-dark); }

.display-font {
    font-family: 'Playfair Display', serif;
    letter-spacing: -0.01em;
}

/* ===================== LAYOUT ===================== */
.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    background: var(--sidebar-bg);
    color: var(--sidebar-text);
    padding: 28px 20px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 0 4px 18px;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    margin-bottom: 16px;
    text-align: center;
}

.brand-sub {
    font-size: 10px;
    color: rgba(245,241,236,0.5);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.brand-logo {
    max-width: 120px;
    width: 100%;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 2px 8px rgba(0,0,0,0.3));
    display: block;
    margin: 0 auto;
}

.brand-icon {
    width: 44px;
    height: 44px;
    background: var(--accent);
    border-radius: 12px;
    display: grid;
    place-items: center;
    font-size: 22px;
    box-shadow: 0 6px 14px rgba(193,78,44,0.35);
}

.topbar-logo {
    height: 38px;
    width: auto;
    max-width: 100px;
    object-fit: contain;
    display: block;
}

.login-logo-img {
    width: 100%;
    max-width: 240px;
    height: auto;
    margin: 0 auto 24px;
    display: block;
}

.login-logo-img img {
    width: 100%;
    height: auto;
    display: block;
    filter: drop-shadow(0 8px 20px rgba(193,78,44,0.25));
}

.brand-name {
    font-family: 'Playfair Display', serif;
    font-size: 18px;
    font-weight: 900;
    letter-spacing: 0.05em;
}

.brand-sub {
    font-size: 11px;
    color: rgba(245,241,236,0.5);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }

.nav-divider {
    font-size: 10px;
    color: rgba(245,241,236,0.35);
    letter-spacing: 0.15em;
    padding: 18px 12px 8px;
    font-weight: 600;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    color: rgba(245,241,236,0.75);
    font-size: 13.5px;
    font-weight: 500;
    transition: all 0.18s ease;
    position: relative;
}

.nav-item:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
}

.nav-item.active {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(193,78,44,0.4);
}

.nav-ico { font-size: 16px; width: 20px; text-align: center; }

.nav-badge {
    margin-left: auto;
    background: var(--red);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 20px;
    text-align: center;
}

.nav-logout { color: rgba(245,200,200,0.7); margin-top: 4px; }
.nav-logout:hover { background: rgba(192,57,43,0.2); color: #ffb3aa; }

.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    background: rgba(255,255,255,0.05);
    border-radius: 12px;
    margin-top: 20px;
}

.user-avatar {
    width: 38px; height: 38px;
    background: linear-gradient(135deg, var(--accent), var(--gold));
    border-radius: 50%;
    display: grid;
    place-items: center;
    font-weight: 700;
    font-size: 16px;
    color: #fff;
}

.user-name { font-size: 13px; font-weight: 600; }
.user-role { font-size: 11px; color: rgba(245,241,236,0.55); }

.main {
    padding: 36px 40px;
    max-width: 100%;
    overflow-x: auto;
}

/* ===================== TOP BAR (mobile) ===================== */
.topbar {
    display: none;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border);
    padding: 8px 12px;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0;
    z-index: 50;
    min-height: 56px;
}

.topbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    justify-content: center;
}

.menu-toggle, .theme-toggle, .notif-toggle, .lang-toggle {
    background: var(--bg-soft);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 8px 10px;
    cursor: pointer;
    font-size: 16px;
    color: var(--ink);
    position: relative;
    transition: background 0.2s;
}

.menu-toggle:hover, .theme-toggle:hover, .notif-toggle:hover, .lang-toggle:hover {
    background: var(--bg-hover);
}

.notif-dot {
    position: absolute;
    top: 4px; right: 4px;
    width: 8px; height: 8px;
    background: var(--red);
    border-radius: 50%;
    border: 2px solid var(--bg-card);
}

/* ===================== HEADINGS ===================== */
.page-head {
    margin-bottom: 28px;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 20px;
    flex-wrap: wrap;
}

.page-title {
    font-family: 'Playfair Display', serif;
    font-size: 32px;
    font-weight: 900;
    color: var(--ink);
    letter-spacing: -0.02em;
}

.page-sub {
    color: var(--ink-muted);
    font-size: 14px;
    margin-top: 4px;
}

/* ===================== CARDS ===================== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.25s ease, transform 0.25s ease;
}

.card:hover {
    box-shadow: var(--shadow);
}

.card.elevated {
    box-shadow: var(--shadow);
}

.card-accent {
    border-top: 3px solid var(--accent);
}

.card-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
    gap: 12px;
    flex-wrap: wrap;
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: -0.01em;
}

/* ===================== STATS GRID ===================== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 18px;
    margin-bottom: 28px;
}

.stat {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 22px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}

.stat:hover { transform: translateY(-2px); box-shadow: var(--shadow); }

.stat::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 4px; height: 100%;
    background: var(--accent);
}

.stat-today::before { background: var(--accent); }
.stat-leaves::before { background: var(--yellow); }
.stat-pending::before { background: var(--blue); }
.stat-approved::before { background: var(--green); }

.stat-label {
    font-size: 11px;
    color: var(--ink-muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    font-weight: 600;
    margin-bottom: 8px;
}

.stat-value {
    font-family: 'Playfair Display', serif;
    font-size: 38px;
    font-weight: 900;
    color: var(--ink);
    line-height: 1;
    letter-spacing: -0.02em;
}

.stat-meta {
    font-size: 12px;
    color: var(--ink-muted);
    margin-top: 6px;
}

/* ===================== TABLES ===================== */
.table-wrap { overflow-x: auto; border-radius: var(--radius); }

table.tbl {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-card);
}

.tbl thead th {
    background: var(--bg-soft);
    padding: 12px 14px;
    text-align: left;
    font-size: 11px;
    color: var(--ink-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-weight: 700;
    border-bottom: 2px solid var(--border);
}

.tbl tbody td {
    padding: 14px;
    border-bottom: 1px solid var(--border);
    font-size: 13.5px;
    color: var(--ink-soft);
}

.tbl tbody tr:hover { background: var(--bg-soft); }
.tbl tbody tr:last-child td { border-bottom: none; }

/* ===================== BADGES ===================== */
.badge {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 6px;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.badge-pending  { background: var(--yellow-soft); color: var(--yellow); }
.badge-approved { background: var(--green-soft);  color: var(--green); }
.badge-rejected { background: var(--red-soft);    color: var(--red); }
.badge-role     { background: var(--bg-soft);     color: var(--ink-soft); }

[data-theme="dark"] .badge-pending { color: #f1c947; }
[data-theme="dark"] .badge-approved { color: #8bc09a; }
[data-theme="dark"] .badge-rejected { color: #f17a6d; }

/* ===================== FORMS ===================== */
.form-group { margin-bottom: 18px; }

.label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--ink-soft);
    margin-bottom: 6px;
    letter-spacing: 0.02em;
}

.input, .select, .textarea {
    width: 100%;
    padding: 11px 14px;
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 14px;
    color: var(--ink);
    transition: border-color 0.18s, box-shadow 0.18s;
}

.input:focus, .select:focus, .textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px rgba(193,78,44,0.12);
}

.textarea { resize: vertical; min-height: 90px; }

/* ===================== BUTTONS ===================== */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 18px;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.18s;
    text-decoration: none;
    white-space: nowrap;
}

.btn-primary {
    background: var(--accent);
    color: #fff;
    box-shadow: 0 4px 12px rgba(193,78,44,0.25);
}
.btn-primary:hover { background: var(--accent-dark); color: #fff; transform: translateY(-1px); }

.btn-secondary {
    background: var(--bg-soft);
    color: var(--ink);
    border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--bg-hover); }

.btn-success { background: var(--green); color: #fff; }
.btn-success:hover { background: #3a6347; color: #fff; }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #962c22; color: #fff; }

.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-icon { padding: 8px 10px; }

/* ===================== FLASH ===================== */
.flash {
    padding: 14px 20px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    border-left: 4px solid;
}

.flash-success { background: var(--green-soft); color: var(--green); border-color: var(--green); }
.flash-error   { background: var(--red-soft);   color: var(--red);   border-color: var(--red); }
.flash-info    { background: var(--blue-soft);  color: var(--blue);  border-color: var(--blue); }

.flash-close { cursor: pointer; font-size: 20px; opacity: 0.6; }
.flash-close:hover { opacity: 1; }

/* ===================== LOGIN PAGE ===================== */
.login-shell,
.login-wrap {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 20px;
    background:
        radial-gradient(circle at 20% 30%, rgba(193,78,44,0.08), transparent 50%),
        radial-gradient(circle at 80% 70%, rgba(184,137,71,0.08), transparent 50%),
        var(--bg);
}

.login-card {
    background: var(--bg-card);
    border-radius: 24px;
    padding: 44px 40px;
    max-width: 420px;
    width: 100%;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--border);
    position: relative;
}

.login-logo {
    width: 72px;
    height: 72px;
    background: linear-gradient(135deg, var(--accent), var(--accent-dark));
    border-radius: 20px;
    display: grid;
    place-items: center;
    font-size: 36px;
    margin: 0 auto 20px;
    box-shadow: 0 12px 28px rgba(193,78,44,0.3);
}

.login-title {
    font-family: 'Playfair Display', serif;
    font-size: 28px;
    font-weight: 900;
    text-align: center;
    margin-bottom: 4px;
    letter-spacing: -0.01em;
}

.login-sub {
    text-align: center;
    color: var(--ink-muted);
    margin-bottom: 28px;
    font-size: 13px;
}

/* ===================== SCHEDULE TABLE ===================== */
.schedule-wrap {
    background: var(--bg-card);
    border-radius: var(--radius);
    padding: 20px;
    overflow-x: auto;
    border: 1px solid var(--border);
    -webkit-overflow-scrolling: touch;
}

.schedule-tools {
    display: flex;
    gap: 12px;
    align-items: center;
    flex-wrap: wrap;
    margin-bottom: 20px;
}

table.schedule {
    border-collapse: collapse;
    font-size: 11px;
    width: 100%;
    min-width: 1100px;
}

.schedule th, .schedule td {
    border: 1px solid var(--border);
    text-align: center;
    padding: 4px 2px;
    height: 28px;
    font-weight: 500;
}

[data-theme="dark"] .schedule th, [data-theme="dark"] .schedule td {
    border-color: #4a3d33;
}

.schedule .month-header {
    background: #fff200;
    color: #c0392b;
    font-family: 'Playfair Display', serif;
    font-size: 16px;
    font-weight: 900;
    height: 32px;
}

.schedule .day-name { background: var(--bg-card); color: #c0392b; font-weight: 700; }
.schedule .day-name.weekend { color: #c0392b; background: var(--yellow-soft); }
.schedule .day-num { background: var(--bg-card); color: #c0392b; font-weight: 700; }
.schedule .day-num.weekend { color: #c0392b; background: var(--weekend-bg); }
.schedule .lunar-row td {
    background: var(--bg-card);
    color: #c0392b;
    font-size: 9px;
    font-style: italic;
    font-weight: 600;
    height: 22px;
}
.schedule .lunar-row td.weekend { background: var(--weekend-bg); }

.schedule .nv-name {
    text-align: center;
    font-weight: 700;
    color: #c0392b;
    background: var(--bg-card);
    min-width: 130px;
    padding: 4px 8px;
    font-size: 11px;
}

.schedule .stt { background: var(--bg-card); font-weight: 600; min-width: 30px; color: var(--ink); }

.schedule .cell-weekend { background: var(--weekend-bg); }
.schedule .cell-leave {
    font-weight: 800;
    color: #c0392b;
    cursor: pointer;
}
.schedule .cell-clickable { cursor: pointer; transition: background 0.15s; }
.schedule .cell-clickable:hover { background: var(--accent-soft) !important; }
.schedule .cell-today {
    box-shadow: inset 0 0 0 2px var(--accent);
    font-weight: 800;
}

.legend-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 8px;
    margin-top: 16px;
    padding: 12px;
    background: var(--bg-soft);
    border-radius: var(--radius-sm);
}

.legend-item {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
}

.legend-code {
    width: 24px; height: 24px;
    border: 1.5px solid;
    border-radius: 4px;
    display: grid;
    place-items: center;
    font-weight: 800;
    font-size: 10px;
}

/* ===================== EMPTY STATE ===================== */
.empty {
    text-align: center;
    padding: 50px 20px;
    color: var(--ink-muted);
}

.empty-ico {
    font-size: 48px;
    margin-bottom: 12px;
    opacity: 0.5;
}

/* ===================== NOTIFICATIONS DROPDOWN ===================== */
.notif-wrap {
    position: relative;
}

.notif-panel {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 360px;
    max-width: 95vw;
    max-height: 480px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    z-index: 100;
    display: none;
}

.notif-panel.show { display: block; }

.notif-head {
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-weight: 700;
    color: var(--ink);
    position: sticky;
    top: 0;
    background: var(--bg-card);
}

.notif-item {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
}

.notif-item:hover { background: var(--bg-soft); }
.notif-item.unread { background: var(--accent-soft); }
[data-theme="dark"] .notif-item.unread { background: rgba(232,113,81,0.1); }

.notif-title { font-weight: 600; color: var(--ink); font-size: 13px; margin-bottom: 2px; }
.notif-msg { font-size: 12px; color: var(--ink-muted); }
.notif-time { font-size: 11px; color: var(--ink-muted); margin-top: 4px; }

/* ===================== MULTI-DATE PICKER ===================== */
.date-picker-wrap {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.date-chip {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 6px 10px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.date-chip-remove {
    cursor: pointer;
    opacity: 0.7;
    font-size: 14px;
    line-height: 1;
}
.date-chip-remove:hover { opacity: 1; }

/* ===================== SEARCH BAR ===================== */
.search-bar {
    background: var(--bg-card);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 4px 8px 4px 14px;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 240px;
}

.search-bar input {
    border: none;
    background: transparent;
    flex: 1;
    padding: 8px 0;
    font-family: inherit;
    font-size: 13.5px;
    color: var(--ink);
}

.search-bar input:focus { outline: none; }

/* ===================== MODAL ===================== */
.modal-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 999;
    place-items: center;
    padding: 20px;
}
.modal-overlay.show { display: grid; }

.modal-overlay .card {
    max-height: 90vh;
    overflow-y: auto;
}

/* ===================== RESPONSIVE ===================== */
/* Backdrop chỉ dùng cho menu mobile; ngoài media query phải ẩn, nếu không nó chiếm 1 cột của .app-shell grid trên desktop */
.sidebar-backdrop { display: none; }

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }

    .topbar { display: flex; }

    .sidebar {
        position: fixed;
        left: -300px;
        top: 0;
        width: 280px;
        height: 100vh;
        z-index: 100;
        transition: left 0.25s ease;
        padding: 20px 16px;
    }
    .sidebar.open { left: 0; box-shadow: 4px 0 24px rgba(0,0,0,0.3); }

    .sidebar-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 99;
    }
    .sidebar-backdrop.show { display: block; }

    .main { padding: 16px 12px; }
    .page-head { margin-bottom: 18px; }
    .page-title { font-size: 22px; }
    .page-sub { font-size: 13px; }
    .stat { padding: 16px; }
    .stat-value { font-size: 28px; }
    .stat-label { font-size: 10px; }

    .card { padding: 16px; }
    .card-title { font-size: 14px; }

    /* Brand sidebar mobile - logo vừa phải */
    .brand-logo { max-width: 100px; }

    /* Global search compact */
    .global-search { max-width: 100%; }
    .global-search input { font-size: 13px; padding: 9px 12px 9px 36px; }

    /* Tables become cards on mobile */
    .tbl-responsive thead { display: none; }
    .tbl-responsive tbody tr {
        display: block;
        background: var(--bg-card);
        border: 1px solid var(--border);
        border-radius: var(--radius);
        padding: 12px;
        margin-bottom: 10px;
    }
    .tbl-responsive tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 6px 0;
        border-bottom: 1px dashed var(--border);
    }
    .tbl-responsive tbody td:last-child { border: none; }
    .tbl-responsive tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        font-size: 11px;
        color: var(--ink-muted);
        text-transform: uppercase;
        margin-right: 12px;
    }
}

/* Màn hình nhỏ < 400px */
@media (max-width: 400px) {
    .main { padding: 12px 10px; }
    .topbar-logo { height: 34px; max-width: 90px; }
    .page-title { font-size: 20px; }
    .stat { padding: 14px; }
    .stat-value { font-size: 24px; }
    .menu-toggle, .theme-toggle, .notif-toggle, .lang-toggle {
        padding: 6px 8px;
        font-size: 15px;
    }
    .btn { padding: 9px 14px; font-size: 12.5px; }
    .row > * { min-width: 100%; }
}

/* PC tối ưu - max-width container */
@media (min-width: 1400px) {
    /* width:100%: margin auto trong ô grid làm .main co theo nội dung (trang hẹp, bảng ca tràn ngang) */
    .main { padding: 40px 60px; width: 100%; max-width: 1400px; margin: 0 auto; }
    .app-shell { grid-template-columns: 280px 1fr; }
}

/* ===================== UTILS ===================== */
.row { display: flex; gap: 18px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 200px; }

.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
.mb-1 { margin-bottom: 8px; }
.mb-2 { margin-bottom: 16px; }
.mb-3 { margin-bottom: 24px; }

.text-muted { color: var(--ink-muted); }
.text-center { text-align: center; }
.text-right { text-align: right; }

.gap-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* ===================== CHARTS ===================== */
.bar-chart {
    display: flex;
    align-items: flex-end;
    gap: 10px;
    height: 200px;
    padding: 20px 0;
    border-bottom: 2px solid var(--border);
}

.bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: 30px;
}

.bar {
    width: 100%;
    background: linear-gradient(180deg, var(--accent), var(--accent-dark));
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

.bar-value {
    position: absolute;
    top: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    font-weight: 700;
    color: var(--ink);
}

.bar-label {
    font-size: 11px;
    color: var(--ink-muted);
    text-align: center;
    margin-top: 4px;
}

/* ===================== PRINT ===================== */
@media print {
    .sidebar, .schedule-tools, .topbar, .page-head .btn, .legend-grid { display: none !important; }
    .main { padding: 0 !important; }
    .app-shell { grid-template-columns: 1fr !important; }
    body { background: white !important; color: black !important; }
}

/* ===================== HOLIDAYS & NEW v3 ===================== */
.schedule .day-num.holiday,
.schedule .cell-holiday {
    background: linear-gradient(180deg, #ffe5e5, #ffcccc);
    color: #c0392b;
    font-weight: 800;
    position: relative;
}

.schedule .day-num.holiday::after {
    content: '🎉';
    position: absolute;
    top: -8px;
    right: -2px;
    font-size: 10px;
}

[data-theme="dark"] .schedule .day-num.holiday,
[data-theme="dark"] .schedule .cell-holiday {
    background: linear-gradient(180deg, #3d1818, #4a1f1f);
}

.holiday-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: linear-gradient(135deg, #fff5e6, #ffe6cc);
    color: #c14e2c;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 700;
}

[data-theme="dark"] .holiday-badge {
    background: linear-gradient(135deg, #3d2419, #2d1810);
    color: #e8b94a;
}

/* Shift badges */
.shift-badge {
    display: inline-block;
    padding: 2px 6px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 700;
}

.shift-sang {
    background: #fff9c4;
    color: #f57f17;
}

.shift-toi {
    background: #c5cae9;
    color: #283593;
}

.shift-ca-ngay {
    background: var(--bg-soft);
    color: var(--ink-soft);
}

/* Daily note card */
.note-card {
    background: linear-gradient(135deg, #fffde7, #fff8e1);
    border-left: 4px solid var(--yellow);
    padding: 14px 18px;
    border-radius: 10px;
    margin-bottom: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05);
}

[data-theme="dark"] .note-card {
    background: linear-gradient(135deg, #3d3018, #2d2210);
}

.note-date {
    font-weight: 700;
    color: var(--accent);
    margin-bottom: 4px;
    font-size: 13px;
}

.note-content {
    color: var(--ink);
    font-size: 14px;
    line-height: 1.5;
}

.note-author {
    font-size: 11px;
    color: var(--ink-muted);
    margin-top: 6px;
}

/* Global search */
.global-search {
    position: relative;
    width: 100%;
    max-width: 340px;
}

.global-search input {
    width: 100%;
    padding: 10px 14px 10px 40px;
    background: var(--bg-soft);
    border: 1.5px solid var(--border);
    border-radius: 30px;
    font-size: 14px;
    color: var(--ink);
    transition: all 0.2s;
}

.global-search input:focus {
    outline: none;
    border-color: var(--accent);
    background: var(--bg-card);
    box-shadow: 0 0 0 4px rgba(193,78,44,0.1);
}

.global-search-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--ink-muted);
    font-size: 14px;
    pointer-events: none;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 6px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    max-height: 400px;
    overflow-y: auto;
    z-index: 100;
    display: none;
}

.search-results.show { display: block; }

.search-result-group {
    padding: 8px 14px;
    font-size: 11px;
    font-weight: 700;
    color: var(--ink-muted);
    background: var(--bg-soft);
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.search-result-item {
    padding: 10px 14px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: background 0.15s;
    display: block;
    color: var(--ink);
    text-decoration: none;
}

.search-result-item:hover {
    background: var(--bg-soft);
}

.search-result-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--ink);
}

.search-result-meta {
    font-size: 11px;
    color: var(--ink-muted);
    margin-top: 2px;
}

/* Better animations */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

.stat, .card {
    animation: fadeInUp 0.4s ease backwards;
}

.stat:nth-child(1) { animation-delay: 0.05s; }
.stat:nth-child(2) { animation-delay: 0.1s; }
.stat:nth-child(3) { animation-delay: 0.15s; }
.stat:nth-child(4) { animation-delay: 0.2s; }

/* Better buttons */
.btn { position: relative; overflow: hidden; }
.btn::before {
    content: '';
    position: absolute;
    top: 50%; left: 50%;
    width: 0; height: 0;
    background: rgba(255,255,255,0.3);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
}
.btn:active::before {
    width: 200%;
    height: 200%;
}

/* Smooth focus */
.input:focus, .select:focus, .textarea:focus {
    transform: translateY(-1px);
}

/* Better nav transitions */
.nav-item {
    position: relative;
}

.nav-item::before {
    content: '';
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: var(--accent);
    border-radius: 0 4px 4px 0;
    transition: height 0.2s ease;
}

.nav-item.active::before {
    height: 60%;
}

/* Loading spinner */
.spinner {
    display: inline-block;
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Nút đổi ngôn ngữ */
.lang-toggle {
    font-weight: 700;
    font-size: 15px;
}
