:root {
    --tk-navy: #161a38;
    --tk-navy-2: #20244d;
    --tk-gold: #b59449;
    --tk-gold-2: #d4b978;
    --tk-bg: #f3f5f9;
    --tk-card: #ffffff;
    --tk-text: #1e293b;
    --tk-muted: #64748b;
    --tk-line: #e2e8f0;
    --tk-radius: 16px;
    --tk-shadow: 0 10px 30px rgba(22, 26, 56, 0.08);
}

* { box-sizing: border-box; }

body {
    margin: 0;
    color: var(--tk-text);
    font-family: "Source Sans 3", "Segoe UI", sans-serif;
    background: var(--tk-bg);
}

a { color: inherit; text-decoration: none; }

.tk-display { font-family: "Libre Baskerville", Georgia, serif; }

/* ========== LOGIN ========== */
.login-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.login-shell::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: var(--login-bg);
    background-size: cover;
    background-position: center;
    transform: scale(1.04);
}

.login-shell::after {
    content: "";
    position: absolute;
    inset: 0;
    background:
        linear-gradient(135deg, rgba(10, 12, 28, 0.88), rgba(22, 26, 56, 0.78)),
        radial-gradient(circle at top right, rgba(181, 148, 73, 0.28), transparent 40%);
}

.login-panel {
    position: relative;
    z-index: 2;
    width: min(100%, 440px);
}

.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    color: #fff;
    margin-bottom: 22px;
}

.login-brand-mark {
    display: block;
    width: 96px;
    height: 96px;
    object-fit: contain;
    border-radius: 18px;
    background: #000;
    border: 1px solid rgba(212, 185, 120, 0.35);
    box-shadow: 0 16px 40px rgba(0, 0, 0, 0.35);
    margin: 0 auto 16px;
}

.login-brand h1 {
    margin: 0;
    font-size: 1.45rem;
    color: var(--tk-gold-2);
    letter-spacing: 0.01em;
    line-height: 1.3;
}

.login-brand p {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.72);
    font-size: 0.92rem;
    letter-spacing: 0.02em;
}

.login-card {
    background: rgba(255, 255, 255, 0.97);
    border-radius: 22px;
    padding: 28px 26px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
    border: 1px solid rgba(255, 255, 255, 0.35);
    backdrop-filter: blur(8px);
}

.login-card h2 {
    margin: 0;
    font-size: 1.55rem;
    color: var(--tk-navy-2);
}

.login-card .subtitle {
    margin: 6px 0 18px;
    color: var(--tk-muted);
    font-size: 0.92rem;
}

.login-footer {
    margin-top: 18px;
    text-align: center;
    color: rgba(255, 255, 255, 0.55);
    font-size: 12px;
    position: relative;
    z-index: 2;
}

/* ========== APP SHELL ========== */
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
    background:
        radial-gradient(circle at top right, rgba(181, 148, 73, 0.12), transparent 30%),
        linear-gradient(180deg, #f7f5f1 0%, #eef1f7 100%);
}

.sidebar {
    background: linear-gradient(180deg, #0f1228 0%, #161a38 100%);
    color: #fff;
    border-right: 1px solid rgba(181, 148, 73, 0.25);
    padding: 20px 16px;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 8px 20px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
    margin-bottom: 18px;
}

.sidebar-brand img {
    width: 48px;
    height: 48px;
    flex-shrink: 0;
    border-radius: 12px;
    object-fit: contain;
    background: #000;
    border: 1px solid rgba(181, 148, 73, 0.4);
}

.sidebar-brand strong {
    display: block;
    color: var(--tk-gold-2);
    font-size: 0.92rem;
    line-height: 1.25;
}

.sidebar-brand span {
    display: block;
    color: rgba(255, 255, 255, 0.55);
    font-size: 11px;
    margin-top: 2px;
    line-height: 1.35;
}

.side-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 12px;
    border-radius: 12px;
    color: rgba(255, 255, 255, 0.75);
    font-size: 0.95rem;
    font-weight: 500;
    margin-bottom: 4px;
    transition: 0.2s ease;
}

.side-link:hover,
.side-link.active {
    background: rgba(181, 148, 73, 0.16);
    color: #fff;
}

.side-link.active {
    border: 1px solid rgba(181, 148, 73, 0.35);
}

.side-section {
    margin: 18px 8px 8px;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.4);
}

.app-main {
    min-width: 0;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px 22px;
    background: rgba(255, 255, 255, 0.82);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--tk-line);
    position: sticky;
    top: 0;
    z-index: 40;
}

.topbar-left {
    display: flex;
    align-items: center;
    gap: 12px;
}

.menu-btn {
    display: none;
    border: 1px solid var(--tk-line);
    background: #fff;
    border-radius: 10px;
    width: 42px;
    height: 42px;
    cursor: pointer;
}

.role-chip {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: rgba(32, 36, 77, 0.08);
    color: var(--tk-navy-2);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    padding: 6px 12px;
}

.page-wrap {
    padding: 22px;
}

.page-header {
    margin-bottom: 20px;
}

.page-header h1 {
    margin: 0;
    font-size: 1.65rem;
    color: var(--tk-navy-2);
}

.page-header p {
    margin: 6px 0 0;
    color: var(--tk-muted);
}

.alert-ok {
    margin-bottom: 16px;
    border-radius: 12px;
    border: 1px solid #a7f3d0;
    background: #ecfdf5;
    color: #065f46;
    padding: 12px 14px;
    font-size: 0.92rem;
}

.alert-warn {
    margin-bottom: 16px;
    border-radius: 12px;
    border: 1px solid #fcd34d;
    background: #fffbeb;
    color: #92400e;
    padding: 12px 14px;
    font-size: 0.92rem;
}

.creds-box {
    margin-bottom: 16px;
    border-radius: 12px;
    padding: 14px 16px;
    border: 1px solid #dbe3ef;
    background: #fff;
}

.creds-box.creds-warn {
    border-color: #fcd34d;
    background: #fffbeb;
}

.creds-box.creds-ok {
    border-color: #a7f3d0;
    background: #ecfdf5;
}

.creds-box strong {
    display: block;
    margin-bottom: 10px;
    color: #20244d;
}

.creds-row {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
    margin-top: 6px;
    font-size: 0.92rem;
}

.creds-row span {
    min-width: 110px;
    color: #64748b;
    font-weight: 600;
}

.creds-row code {
    background: #0f172a;
    color: #f8fafc;
    padding: 6px 10px;
    border-radius: 8px;
    font-size: 0.9rem;
    word-break: break-all;
}

/* ========== DASHBOARD ========== */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 14px;
    margin-bottom: 18px;
}

.stat-card,
.panel-card,
.action-card,
.dept-card {
    background: var(--tk-card);
    border: 1px solid rgba(226, 232, 240, 0.95);
    border-radius: var(--tk-radius);
    box-shadow: var(--tk-shadow);
}

.stat-card {
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px rgba(22, 26, 56, 0.12);
    border-color: rgba(181, 148, 73, 0.35);
}

.stat-card::after {
    content: "";
    position: absolute;
    right: -20px;
    top: -20px;
    width: 90px;
    height: 90px;
    border-radius: 50%;
    background: rgba(181, 148, 73, 0.12);
}

.stat-label {
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--tk-muted);
    font-weight: 700;
}

.stat-value {
    margin-top: 10px;
    font-size: 2rem;
    font-weight: 700;
    color: var(--tk-navy-2);
    line-height: 1;
}

.stat-value.amber { color: #d97706; }
.stat-value.green { color: #059669; }
.stat-value.rose { color: #e11d48; }

.content-grid {
    display: grid;
    grid-template-columns: 1.7fr 1fr;
    gap: 16px;
}

.panel-card {
    padding: 20px;
    transition: box-shadow 0.2s ease;
}

.panel-card:hover {
    box-shadow: 0 14px 34px rgba(22, 26, 56, 0.1);
}

.panel-title {
    margin: 0 0 14px;
    font-size: 1.15rem;
    color: var(--tk-navy-2);
}

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

.action-card {
    display: block;
    padding: 16px 18px;
    transition: 0.2s ease;
    background: linear-gradient(180deg, #fff, #fafbfd);
}

.action-card:hover {
    border-color: rgba(181, 148, 73, 0.7);
    transform: translateY(-3px);
    box-shadow: 0 12px 28px rgba(22, 26, 56, 0.1);
}

.action-card strong {
    display: block;
    color: var(--tk-navy-2);
    margin-bottom: 4px;
}

.action-card span {
    color: var(--tk-muted);
    font-size: 0.9rem;
    line-height: 1.4;
}

.profile-rows {
    display: grid;
    gap: 12px;
}

.profile-row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.92rem;
    padding-bottom: 10px;
    border-bottom: 1px solid #f1f5f9;
}

.profile-row dt { color: var(--tk-muted); }
.profile-row dd { margin: 0; font-weight: 600; text-align: right; }

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

.dept-card {
    padding: 16px;
    background: #f8fafc;
}

.dept-card strong {
    display: block;
    color: var(--tk-navy-2);
    font-size: 0.92rem;
}

.dept-card b {
    display: block;
    margin-top: 8px;
    font-size: 1.6rem;
    color: var(--tk-navy-2);
}

.btn-primary,
.btn-gold {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 12px;
    padding: 11px 16px;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    color: #fff;
}

.btn-primary {
    background: linear-gradient(135deg, #20244d, #2f3670);
    width: 100%;
}

.btn-gold {
    background: linear-gradient(135deg, #b59449, #c9aa63);
}

.btn-primary:hover,
.btn-gold:hover { filter: brightness(1.06); }

.form-field { margin-bottom: 16px; }
.form-field label {
    display: block;
    font-size: 0.82rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: #475569;
    margin-bottom: 8px;
}

.form-field input[type="email"],
.form-field input[type="password"],
.form-field input[type="text"],
.form-field input[type="number"],
.form-field input[type="date"],
.form-field input[type="file"],
.form-field select,
.form-field textarea,
.profile-tab-body input[type="email"],
.profile-tab-body input[type="password"],
.profile-tab-body input[type="text"],
.profile-tab-body input[type="number"],
.profile-tab-body input[type="date"],
.profile-tab-body input[type="file"],
.profile-tab-body select,
.profile-tab-body textarea {
    width: 100%;
    border: 1.5px solid #e2e8f0;
    border-radius: 14px;
    padding: 13px 16px;
    font: inherit;
    font-size: 0.98rem;
    color: #0f172a;
    background: linear-gradient(180deg, #ffffff 0%, #f8fafc 100%);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.8), 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.form-field textarea,
.profile-tab-body textarea {
    min-height: 110px;
    resize: vertical;
    line-height: 1.5;
}

.form-field input:hover,
.form-field select:hover,
.form-field textarea:hover,
.profile-tab-body input:hover,
.profile-tab-body select:hover,
.profile-tab-body textarea:hover {
    border-color: #cbd5e1;
}

.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus,
.profile-tab-body input:focus,
.profile-tab-body select:focus,
.profile-tab-body textarea:focus {
    outline: none;
    border-color: #b59449;
    background: #fff;
    box-shadow: 0 0 0 4px rgba(181, 148, 73, 0.18), 0 8px 20px rgba(32, 36, 77, 0.06);
}

.form-field input::placeholder,
.form-field textarea::placeholder,
.profile-tab-body input::placeholder,
.profile-tab-body textarea::placeholder {
    color: #94a3b8;
}

.form-field select,
.profile-tab-body select {
    cursor: pointer;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%2364748b' d='M1.4.6 6 5.2 10.6.6 12 2 6 8 0 2z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    padding-right: 40px;
}

.form-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: 14px 0 18px;
    font-size: 0.9rem;
}

.user-meta {
    text-align: right;
}

.user-meta strong {
    display: block;
    font-size: 0.92rem;
}

.user-meta span {
    color: var(--tk-muted);
    font-size: 12px;
}

.mobile-backdrop {
    display: none;
}

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

.filter-bar {
    display: grid;
    grid-template-columns: 1.4fr repeat(3, 1fr) auto;
    gap: 10px;
    padding: 14px;
    align-items: center;
}

.filter-bar input,
.filter-bar select {
    width: 100%;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 10px 12px;
    font: inherit;
    background: #fff;
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
}

.data-table th {
    text-align: left;
    background: #f8fafc;
    color: #64748b;
    font-size: 11px;
    letter-spacing: .06em;
    text-transform: uppercase;
    padding: 12px 14px;
    border-bottom: 1px solid #e2e8f0;
}

.data-table td {
    padding: 14px;
    border-bottom: 1px solid #f1f5f9;
    vertical-align: top;
}

.cell-title { font-weight: 700; color: #20244d; }
.cell-sub { color: #64748b; font-size: 12px; margin-top: 3px; }

.row-actions {
    display: inline-flex;
    gap: 12px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}

.row-actions a { color: #20244d; font-weight: 700; }
.link-danger, .link-danger button {
    color: #e11d48 !important;
    font-weight: 700;
    background: none;
    border: 0;
    cursor: pointer;
    padding: 0;
    font: inherit;
}
.link-ok { color: #059669; font-weight: 700; background: none; border: 0; cursor: pointer; font: inherit; }

.status-pill {
    display: inline-flex;
    border-radius: 999px;
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
    background: #f1f5f9;
    color: #475569;
}
.status-active, .status-approved { background: #ecfdf5; color: #047857; }
.status-pending { background: #fffbeb; color: #b45309; }
.status-rejected, .status-left, .status-terminated { background: #fff1f2; color: #be123c; }
.status-na, .status-cancelled { background: #f8fafc; color: #64748b; }

.btn-cancel {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid #cbd5e1;
    border-radius: 12px;
    padding: 11px 16px;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    color: #475569;
    background: #fff;
}

.btn-cancel:hover {
    background: #f8fafc;
}

.dept-card-link {
    display: block;
    color: inherit;
    text-decoration: none;
}

.dept-card-link:hover .dept-card {
    border-color: rgba(181, 148, 73, 0.7);
    transform: translateY(-2px);
    transition: 0.2s ease;
}

.balance-boxes {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 10px;
}

.balance-box {
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    padding: 14px;
    background: linear-gradient(180deg, #fff, #f8fafc);
}

.balance-number {
    font-size: 1.8rem;
    font-weight: 800;
    color: #20244d;
    margin: 8px 0 4px;
}

.gold-box {
    border: 1px solid rgba(181,148,73,.4);
    background: rgba(181,148,73,.08);
    border-radius: 14px;
    padding: 14px;
}

.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.check-item { display: flex; gap: 8px; align-items: center; font-size: .92rem; }

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

.cal-cell {
    min-height: 64px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
    padding: 8px;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.cal-cell.head {
    min-height: auto;
    border: 0;
    background: transparent;
    font-size: 11px;
    font-weight: 700;
    color: #64748b;
    text-align: center;
    cursor: default;
}

.cal-cell.muted { opacity: .35; cursor: default; }
.cal-cell.holiday { background: #fffbeb; border-color: #fcd34d; }
.cal-cell.today { border-color: #b59449; box-shadow: inset 0 0 0 1px #b59449; }
.cal-cell small { display: block; margin-top: 4px; font-size: 10px; color: #92400e; }

.legend { display: flex; gap: 14px; font-size: 12px; color: #64748b; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.holiday { background: #fbbf24; }
.dot.today { background: #b59449; }

.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,18,40,.55);
    display: grid;
    place-items: center;
    z-index: 80;
    padding: 16px;
    overflow-y: auto;
}

.modal-card {
    width: min(100%, 540px);
    max-height: min(92vh, 720px);
    background: #fff;
    border-radius: 18px;
    box-shadow: 0 24px 60px rgba(0,0,0,.28);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    margin: auto;
}

.modal-card.modal-card-wide {
    width: min(100%, 920px);
    max-height: min(94vh, 860px);
}

.modal-card-header {
    padding: 20px 28px 12px;
    flex-shrink: 0;
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 12px;
    border-bottom: 1px solid #f1f5f9;
}

.modal-card-body {
    padding: 16px 28px 12px;
    overflow-y: auto;
    flex: 1 1 auto;
    -webkit-overflow-scrolling: touch;
}

.modal-role-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 16px;
    padding: 12px 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(32,36,77,0.06), rgba(181,148,73,0.12));
    border: 1px solid rgba(181,148,73,0.25);
}

.modal-role-banner strong {
    color: #20244d;
    font-size: 0.95rem;
}

.modal-card-footer {
    padding: 12px 22px 18px;
    border-top: 1px solid #e2e8f0;
    background: #fff;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    flex-shrink: 0;
}

.modal-close {
    background: transparent;
    border: 0;
    font-size: 1.5rem;
    line-height: 1;
    color: #64748b;
    cursor: pointer;
    padding: 0 4px;
}

.dept-card-active .dept-card {
    border-color: #b59449;
    box-shadow: 0 0 0 2px rgba(181, 148, 73, 0.25);
}

.dept-card-wrap {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.dept-card-actions {
    display: flex;
    gap: 14px;
    justify-content: center;
    padding: 8px 12px 12px;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-top: 0;
    border-radius: 0 0 12px 12px;
    margin-top: -10px;
}

.dept-card-wrap .dept-card-link .dept-card {
    border-radius: 12px 12px 0 0;
}

.link-warn {
    background: none;
    border: 0;
    padding: 0;
    color: #b45309;
    font-weight: 600;
    cursor: pointer;
    font-size: inherit;
}

.link-warn:hover {
    text-decoration: underline;
    color: #92400e;
}

.dept-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid #f1f5f9;
}

.dept-edit { display: flex; gap: 8px; align-items: center; }
.dept-edit input {
    border: 1px solid #cbd5e1;
    border-radius: 10px;
    padding: 8px 10px;
    min-width: 220px;
    font: inherit;
}

.team-card:hover {
    border-color: rgba(181,148,73,.55);
    transform: translateY(-2px);
    transition: .2s ease;
}

.reason-row td {
    background: #f8fafc;
    color: #64748b;
    font-size: 12px;
    padding-top: 0 !important;
    border-bottom: 1px solid #e2e8f0;
}

@media (max-width: 1100px) {
    .stat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .dept-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .content-grid { grid-template-columns: 1fr; }
    .filter-bar { grid-template-columns: 1fr 1fr; }
    .form-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
    .app-shell { grid-template-columns: 1fr; }
    .sidebar {
        position: fixed;
        left: 0;
        top: 0;
        bottom: 0;
        width: min(86vw, 300px);
        z-index: 60;
        transform: translateX(-105%);
        transition: transform 0.25s ease;
    }
    .sidebar.open { transform: translateX(0); }
    .menu-btn { display: inline-grid; place-items: center; }
    .mobile-backdrop {
        display: block;
        position: fixed;
        inset: 0;
        background: rgba(15, 18, 40, 0.5);
        z-index: 50;
    }
    .action-grid { grid-template-columns: 1fr; }
    .dept-row { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
    .stat-grid,
    .dept-grid { grid-template-columns: 1fr; }
    .page-wrap { padding: 16px; }
    .login-card { padding: 22px 18px; }
    .topbar { padding: 12px 14px; }
    .filter-bar { grid-template-columns: 1fr; }
}

.leave-filter-grid {
    grid-template-columns: repeat(5, minmax(0, 1fr));
    margin-bottom: 16px;
}

.leave-filter-card {
    text-decoration: none;
    color: inherit;
    transition: 0.2s ease;
}

.leave-filter-card:hover,
.leave-filter-card.is-active {
    border-color: rgba(181, 148, 73, 0.75);
    box-shadow: 0 12px 28px rgba(32, 36, 77, 0.12);
    transform: translateY(-2px);
}

.leave-filter-card.is-active::after {
    background: rgba(181, 148, 73, 0.22);
}

.panel-card-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 16px 18px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #fff, #fafbfc);
}

.dash-hero {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    flex-wrap: wrap;
    align-items: flex-start;
    width: 100%;
    padding: 24px 26px;
    border-radius: calc(var(--tk-radius) + 4px);
    background:
        linear-gradient(135deg, rgba(32, 36, 77, 0.97), rgba(22, 26, 56, 0.92)),
        radial-gradient(circle at top right, rgba(181, 148, 73, 0.35), transparent 45%);
    color: #fff;
    box-shadow: 0 18px 40px rgba(22, 26, 56, 0.18);
    border: 1px solid rgba(181, 148, 73, 0.25);
    position: relative;
    overflow: hidden;
}

.dash-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.04), transparent);
    pointer-events: none;
}

.dash-hero > * {
    position: relative;
    z-index: 1;
}

.dash-hero h1 {
    margin: 0;
    font-size: clamp(1.5rem, 2.5vw, 2rem);
    color: #fff;
    line-height: 1.2;
}

.dash-hero p {
    margin: 8px 0 0;
    color: rgba(255, 255, 255, 0.78);
    max-width: 560px;
    line-height: 1.55;
}

.dash-eyebrow {
    display: inline-flex;
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--tk-gold-2);
    margin-bottom: 8px;
    padding: 5px 10px;
    border-radius: 999px;
    background: rgba(181, 148, 73, 0.18);
    border: 1px solid rgba(212, 185, 120, 0.35);
}

.dash-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 12px;
    color: rgba(255, 255, 255, 0.65);
    font-size: 0.9rem;
}

.dash-hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.profile-side-card {
    background:
        radial-gradient(circle at top right, rgba(181,148,73,0.12), transparent 40%),
        #fff;
}

.profile-side-top {
    display: flex;
    gap: 12px;
    align-items: center;
}

.profile-avatar {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    object-fit: cover;
    border: 1px solid rgba(181,148,73,0.35);
}

.profile-avatar.placeholder {
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, #20244d, #3a4278);
    color: #d4b978;
    font-weight: 800;
    font-size: 1.2rem;
}

.profile-avatar.placeholder.small {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    font-size: 1rem;
}

.team-info-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 16px;
    padding-top: 14px;
    border-top: 1px solid #f1f5f9;
}

@media (max-width: 1100px) {
    .leave-filter-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .leave-filter-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
    .team-info-grid {
        grid-template-columns: 1fr;
    }
}

/* Profile section tabs as buttons */
.profile-shell {
    overflow: hidden;
    padding: 0;
}

.profile-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    padding: 14px 16px;
    border-bottom: 1px solid #e2e8f0;
    background: linear-gradient(180deg, #f8fafc, #fff);
}

.profile-tab {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 14px;
    border-radius: 10px;
    border: 1px solid #dbe3ef;
    background: #fff;
    color: #334155;
    font-size: 0.86rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    transition: 0.18s ease;
}

.profile-tab:hover {
    border-color: rgba(181, 148, 73, 0.55);
    color: #20244d;
    transform: translateY(-1px);
}

.profile-tab.is-active {
    background: linear-gradient(135deg, #20244d, #3a4278);
    border-color: #20244d;
    color: #f6e7b8;
    box-shadow: 0 8px 18px rgba(32, 36, 77, 0.22);
}

.profile-tab-body {
    padding: 28px;
    background:
        radial-gradient(circle at top right, rgba(181,148,73,0.06), transparent 40%),
        #fff;
}

.profile-tab-body .form-grid {
    gap: 18px;
}

.row-actions {
    display: inline-flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
    align-items: center;
}

.row-actions a,
.row-actions button,
.action-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px 12px;
    border-radius: 999px;
    border: 1px solid #e2e8f0;
    background: #fff;
    font-size: 0.8rem;
    font-weight: 700;
    text-decoration: none;
    cursor: pointer;
    transition: 0.15s ease;
    color: #20244d;
}

.row-actions a:hover,
.row-actions button:hover,
.action-pill:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 14px rgba(22, 26, 56, 0.1);
}

.row-actions .link-ok,
.action-pill.view {
    color: #047857;
    border-color: #a7f3d0;
    background: #ecfdf5;
}

.row-actions .link-warn,
.action-pill.warn {
    color: #b45309;
    border-color: #fcd34d;
    background: #fffbeb;
}

.row-actions .link-danger,
.action-pill.danger {
    color: #be123c;
    border-color: #fecdd3;
    background: #fff1f2;
}

.record-modal-card {
    width: min(100%, 980px);
    max-height: min(94vh, 900px);
}

.record-section {
    margin-bottom: 18px;
    padding: 16px 18px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
}

.record-section h4 {
    margin: 0 0 12px;
    font-family: "Libre Baskerville", Georgia, serif;
    color: #20244d;
    font-size: 1.05rem;
}

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

.record-item dt {
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: #64748b;
    margin: 0 0 2px;
}

.record-item dd {
    margin: 0;
    color: #0f172a;
    font-weight: 600;
    font-size: 0.95rem;
    word-break: break-word;
}

.record-hero {
    display: flex;
    gap: 16px;
    align-items: center;
    margin-bottom: 18px;
    padding-bottom: 16px;
    border-bottom: 1px solid #e2e8f0;
}

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

.profile-detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.photo-upload-row {
    display: flex;
    align-items: center;
    gap: 16px;
    flex-wrap: wrap;
}

/* User photos */
.user-photo {
    display: inline-grid;
    place-items: center;
    flex-shrink: 0;
    overflow: hidden;
    border-radius: 14px;
    border: 1px solid rgba(181, 148, 73, 0.35);
    background: linear-gradient(135deg, #20244d, #3a4278);
    color: #d4b978;
    font-weight: 800;
    padding: 0;
    margin: 0;
    font-family: inherit;
}

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

.user-photo.photo-sm {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    font-size: 0.85rem;
}

.user-photo.photo-md {
    width: 48px;
    height: 48px;
    font-size: 1rem;
}

.user-photo.photo-lg {
    width: 72px;
    height: 72px;
    border-radius: 18px;
    font-size: 1.35rem;
}

.user-photo.has-photo {
    background: #fff;
}

.user-photo.is-zoomable {
    cursor: zoom-in;
    transition: 0.18s ease;
}

.user-photo.is-zoomable:hover {
    transform: scale(1.04);
    box-shadow: 0 8px 20px rgba(32, 36, 77, 0.18);
    border-color: #b59449;
}

.photo-lightbox {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: grid;
    place-items: center;
    background: rgba(15, 18, 40, 0.72);
    padding: 20px;
}

.photo-lightbox[hidden] {
    display: none !important;
}

.photo-lightbox-panel {
    position: relative;
    max-width: min(92vw, 520px);
    background: #fff;
    border-radius: 18px;
    padding: 16px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}

.photo-lightbox-panel img {
    display: block;
    width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 12px;
    background: #f8fafc;
}

.photo-lightbox-name {
    margin-top: 12px;
    text-align: center;
    font-weight: 700;
    color: #20244d;
}

.photo-lightbox-close {
    position: absolute;
    top: 8px;
    right: 10px;
    width: 34px;
    height: 34px;
    border: 0;
    border-radius: 999px;
    background: #20244d;
    color: #fff;
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
}

@media (max-width: 640px) {
    .profile-detail-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== PAGINATION ========== */
.hr-pagination-wrap {
    padding: 14px 18px;
    border-top: 1px solid var(--tk-line);
    background: linear-gradient(180deg, #fff, #fafbfc);
}

.hr-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
}

.hr-pagination-info {
    color: var(--tk-muted);
    font-size: 0.92rem;
}

.hr-pagination-info strong {
    color: var(--tk-navy-2);
    font-weight: 700;
}

.hr-pagination-links {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: wrap;
}

.hr-page-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 38px;
    height: 38px;
    padding: 0 12px;
    border-radius: 10px;
    border: 1px solid var(--tk-line);
    background: #fff;
    color: var(--tk-navy-2);
    font-weight: 600;
    font-size: 0.92rem;
    transition: 0.18s ease;
}

.hr-page-btn:hover:not(.hr-page-btn-disabled):not(.hr-page-btn-active) {
    border-color: rgba(181, 148, 73, 0.6);
    color: var(--tk-navy-2);
    background: rgba(181, 148, 73, 0.08);
    transform: translateY(-1px);
}

.hr-page-btn-active {
    background: linear-gradient(135deg, var(--tk-navy-2), #2d3268);
    border-color: var(--tk-navy-2);
    color: var(--tk-gold-2);
    box-shadow: 0 6px 16px rgba(32, 36, 77, 0.22);
}

.hr-page-btn-disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.hr-page-dots {
    color: var(--tk-muted);
    padding: 0 4px;
    font-weight: 700;
}

/* ========== TABLE POLISH ========== */
.data-table tbody tr {
    transition: background 0.15s ease;
}

.data-table tbody tr:hover {
    background: rgba(181, 148, 73, 0.04);
}

.data-table th {
    background: linear-gradient(180deg, #f8fafc, #f1f5f9);
    font-size: 0.78rem;
    letter-spacing: 0.06em;
}

.page-header .dash-hero,
.page-header > .dash-hero {
    margin: 0;
}

@media (max-width: 768px) {
    .hr-pagination {
        flex-direction: column;
        align-items: stretch;
    }

    .hr-pagination-links {
        justify-content: center;
    }

    .dash-hero {
        padding: 18px;
    }
}

/* Self-service profile polish */
.profile-section-head {
    margin-bottom: 18px;
}

.profile-section-head h3 {
    margin: 0;
    font-family: "Libre Baskerville", Georgia, serif;
    font-size: 1.25rem;
    color: #20244d;
}

.profile-section-head p {
    margin: 6px 0 0;
    color: #64748b;
    font-size: 0.92rem;
}

.profile-subhead {
    margin: 18px 0 10px;
    font-size: 0.95rem;
    color: #20244d;
    font-weight: 700;
}

.profile-form-panel {
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid #e2e8f0;
    border-radius: 14px;
    background: #f8fafc;
}

.profile-record-list {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.profile-record-card {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
    padding: 14px 16px;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    background: #fff;
}

.profile-record-card--stack {
    flex-direction: column;
    align-items: stretch;
}

.profile-empty {
    margin: 0;
    padding: 18px;
    text-align: center;
    color: #64748b;
    border: 1px dashed #cbd5e1;
    border-radius: 12px;
    background: #f8fafc;
}

.record-note {
    margin: 10px 0 0;
    color: #334155;
    font-size: 0.92rem;
}

.record-note.muted {
    color: #64748b;
}

.user-photo.is-zoomable {
    cursor: zoom-in;
}

.user-photo.is-zoomable:hover {
    box-shadow: 0 0 0 3px rgba(181, 148, 73, 0.35);
}

