/* ============================================================
   Personal Work Time Tracker — Custom CSS
   Theme: Apple-inspired, Black & White, Premium Minimal
   Font: Inter (Google Fonts)
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
    --bg:          #f7f7f8;
    --surface:     #ffffff;
    --surface-2:   #f2f2f4;
    --border:      #e5e7eb;
    --border-2:    #d1d5db;

    --text-primary:   #111111;
    --text-secondary: #6b7280;
    --text-tertiary:  #9ca3af;

    --black:       #111111;
    --white:       #ffffff;

    --success:     #16a34a;
    --success-bg:  #f0fdf4;
    --success-border: #bbf7d0;

    --danger:      #dc2626;
    --danger-bg:   #fef2f2;
    --danger-border: #fecaca;

    --info:        #2563eb;
    --info-bg:     #eff6ff;
    --info-border: #bfdbfe;

    --warning:     #d97706;
    --warning-bg:  #fffbeb;

    --radius:      16px;
    --radius-sm:   10px;
    --radius-lg:   24px;
    --radius-pill: 999px;

    --shadow-xs:   0 1px 2px rgba(0,0,0,.04);
    --shadow-sm:   0 2px 8px rgba(0,0,0,.06);
    --shadow-md:   0 4px 20px rgba(0,0,0,.08);
    --shadow-lg:   0 8px 40px rgba(0,0,0,.12);
    --shadow-xl:   0 20px 60px rgba(0,0,0,.16);

    --sidebar-width:   240px;
    --nav-height:      60px;  /* mobile top bar height */
    --transition:      all .2s cubic-bezier(.4,0,.2,1);
    --transition-slow: all .35s cubic-bezier(.4,0,.2,1);
}

/* ── Reset & Base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; font-size: 16px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg);
    color: var(--text-primary);
    line-height: 1.6;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }
button { cursor: pointer; font-family: inherit; }

/* ── Scrollbar ─────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-tertiary); }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
    position: fixed;
    left: 0; top: 0;
    width: var(--sidebar-width);
    height: 100vh;
    background: var(--surface);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 1000;
    overflow: hidden;
    transition: transform .3s cubic-bezier(.4,0,.2,1), box-shadow .3s ease;
}
.sidebar-header {
    padding: 20px 16px 18px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    font-size: 1rem;
    letter-spacing: -.3px;
    color: var(--black);
    transition: var(--transition);
}
.sidebar-brand:hover { opacity: .75; }
.sidebar-brand-icon {
    width: 34px; height: 34px;
    background: var(--black);
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    color: var(--white);
    font-size: .9rem;
    flex-shrink: 0;
}
.sidebar-brand-text { font-size: 1.05rem; font-weight: 800; letter-spacing: -.3px; }

/* Scrollable nav region */
.sidebar-nav {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    padding: 14px 10px;
    scrollbar-width: thin;
    scrollbar-color: var(--border-2) transparent;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--border-2); border-radius: 99px; }

.sidebar-section-label {
    font-size: .65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .09em;
    color: var(--text-tertiary);
    padding: 0 12px;
    margin: 4px 0 6px;
}
.sidebar-menu {
    list-style: none;
    margin: 0;
    padding: 0;
}
.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    font-size: .875rem;
    font-weight: 500;
    color: var(--text-secondary);
    transition: var(--transition);
    margin-bottom: 1px;
    white-space: nowrap;
    overflow: hidden;
}
.sidebar-link i { font-size: 1rem; flex-shrink: 0; }
.sidebar-link:hover  { background: var(--surface-2); color: var(--black); }
.sidebar-link.active {
    background: var(--black);
    color: var(--white);
    font-weight: 600;
    box-shadow: var(--shadow-sm);
}
.sidebar-link-logout:hover { background: var(--danger-bg); color: var(--danger); }

/* User footer */
.sidebar-footer {
    padding: 10px;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    transition: var(--transition);
    cursor: pointer;
    text-decoration: none;
    color: inherit;
}
.sidebar-user:hover { background: var(--surface-2); }
.sidebar-user-avatar {
    width: 32px; height: 32px;
    background: var(--black);
    border-radius: 9px;
    color: var(--white);
    font-size: .8rem;
    font-weight: 800;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}
.sidebar-user-info { min-width: 0; }
.sidebar-user-name {
    font-size: .8rem;
    font-weight: 700;
    color: var(--black);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.sidebar-user-email {
    font-size: .7rem;
    color: var(--text-tertiary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Mobile top bar (hidden on desktop) ───────────────────────── */
.mobile-topbar {
    display: none;                    /* shown only via media query */
    position: fixed;
    top: 0; left: 0; right: 0;
    height: var(--nav-height);
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    border-bottom: 1px solid var(--border);
    z-index: 998;
    padding: 0 20px;
    align-items: center;
    justify-content: space-between;
}

/* Hamburger */
.nav-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: var(--transition);
}
.nav-toggle:hover { background: var(--surface-2); }
.nav-toggle span {
    display: block;
    width: 22px; height: 2px;
    background: var(--black);
    border-radius: 2px;
    transition: var(--transition);
}
/* Animate hamburger to ✕ when open */
.nav-toggle.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-toggle.is-open span:nth-child(2) { opacity: 0; transform: scaleX(0); }
.nav-toggle.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

/* Sidebar backdrop overlay (mobile) */
.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.35);
    z-index: 999;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
    animation: fadeIn .2s ease;
}
.sidebar-overlay.visible { display: block; }

/* ── Main Content ───────────────────────────────────────────── */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
}
.page-wrapper {
    max-width: 1200px;
    margin: 0 auto;
    padding: 40px 24px 60px;
}

/* ── Page Header ─────────────────────────────────────────────── */
.page-header {
    margin-bottom: 32px;
    animation: fadeInUp .5s ease both;
}
.page-greeting {
    font-size: 1.75rem;
    font-weight: 800;
    letter-spacing: -.5px;
    color: var(--black);
    line-height: 1.2;
}
.page-subtitle {
    margin-top: 4px;
    font-size: .95rem;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
}
.page-subtitle .dot { color: var(--border-2); }
#live-clock {
    font-variant-numeric: tabular-nums;
    font-weight: 600;
    color: var(--text-primary);
}

/* ── Cards ───────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-xs);
    transition: var(--transition-slow);
}
.card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-2px);
}
.card-body { padding: 24px; }
.card-label {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-tertiary);
    margin-bottom: 8px;
}
.card-value {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -.5px;
    color: var(--black);
    line-height: 1;
}
.card-value-sm {
    font-size: 1.3rem;
    font-weight: 700;
    color: var(--black);
}
.card-icon {
    width: 42px; height: 42px;
    border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem;
    margin-bottom: 16px;
}
.card-icon.green  { background: var(--success-bg); color: var(--success); }
.card-icon.blue   { background: var(--info-bg);    color: var(--info);    }
.card-icon.gray   { background: var(--surface-2);  color: var(--text-secondary); }
.card-icon.black  { background: var(--black);       color: var(--white);   }

/* Today Status Card */
.status-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 32px;
    box-shadow: var(--shadow-sm);
    animation: fadeInUp .5s .1s ease both;
}
.status-card-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 16px;
    margin-bottom: 28px;
}
.status-card-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--black);
}
.status-fields {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 20px;
    margin-bottom: 28px;
}
.status-field-label {
    font-size: .75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-tertiary);
    margin-bottom: 4px;
}
.status-field-value {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--black);
    font-variant-numeric: tabular-nums;
}

/* Office Hours bar */
.office-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 16px;
    background: var(--surface-2);
    border-radius: var(--radius-sm);
    font-size: .85rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    animation: fadeInUp .5s .15s ease both;
}
.office-bar strong { color: var(--black); }

/* ── Badges / Status ──────────────────────────────────────────── */
.badge-status {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 4px 12px;
    border-radius: var(--radius-pill);
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .02em;
}
.badge-status .dot-pulse {
    width: 7px; height: 7px;
    border-radius: 50%;
    display: inline-block;
}
.badge-completed  { background: var(--success-bg);  color: var(--success);  border: 1px solid var(--success-border); }
.badge-working    { background: var(--info-bg);      color: var(--info);     border: 1px solid var(--info-border); }
.badge-weekend    { background: var(--surface-2);    color: var(--text-secondary); border: 1px solid var(--border); }
.badge-pending    { background: var(--warning-bg);   color: var(--warning);  border: 1px solid #fde68a; }

.dot-pulse-working { background: var(--info); animation: pulseDot 1.4s ease infinite; }
.dot-pulse-completed { background: var(--success); }
.dot-pulse-weekend   { background: var(--text-tertiary); }

/* ── Buttons ──────────────────────────────────────────────────── */
.btn-action {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px 40px;
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -.1px;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    min-width: 200px;
    position: relative;
    overflow: hidden;
}
.btn-action::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255,255,255,0);
    transition: var(--transition);
}
.btn-action:hover::after { background: rgba(255,255,255,.1); }
.btn-action:active { transform: scale(.97); }

.btn-checkin {
    background: var(--success);
    color: var(--white);
    box-shadow: 0 4px 20px rgba(22,163,74,.3);
}
.btn-checkin:hover { box-shadow: 0 6px 30px rgba(22,163,74,.45); transform: translateY(-1px); }

.btn-checkout {
    background: var(--danger);
    color: var(--white);
    box-shadow: 0 4px 20px rgba(220,38,38,.3);
}
.btn-checkout:hover { box-shadow: 0 6px 30px rgba(220,38,38,.45); transform: translateY(-1px); }

.btn-completed {
    background: var(--surface-2);
    color: var(--text-tertiary);
    cursor: not-allowed;
    box-shadow: none;
}
.btn-completed:hover { transform: none; box-shadow: none; }

.btn-primary-dark {
    background: var(--black);
    color: var(--white);
    padding: 12px 28px;
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-primary-dark:hover { background: #333; transform: translateY(-1px); box-shadow: var(--shadow-md); }

.btn-outline {
    background: transparent;
    color: var(--black);
    padding: 10px 22px;
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-size: .9rem;
    font-weight: 600;
    border: 1.5px solid var(--border-2);
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.btn-outline:hover { border-color: var(--black); background: var(--surface-2); }

/* Loading spinner on button */
.btn-spinner {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,.4);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .7s linear infinite;
    display: none;
}
.btn-action.loading .btn-spinner { display: block; }
.btn-action.loading .btn-text { opacity: .6; }

/* ── Summary Grid ─────────────────────────────────────────────── */
.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
    animation: fadeInUp .5s .2s ease both;
}

/* ── Table ────────────────────────────────────────────────────── */
.table-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    box-shadow: var(--shadow-xs);
}
.table-card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.table-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--black);
}
.table-scroll { overflow-x: auto; }
.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .875rem;
}
.data-table thead th {
    padding: 12px 20px;
    text-align: left;
    font-size: .7rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-tertiary);
    background: var(--surface-2);
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table tbody tr {
    border-bottom: 1px solid var(--border);
    transition: var(--transition);
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--surface-2); }
.data-table tbody td {
    padding: 14px 20px;
    color: var(--text-primary);
    white-space: nowrap;
}
.data-table tbody td.muted { color: var(--text-secondary); }

/* ── Chart Card ───────────────────────────────────────────────── */
.chart-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 24px;
    box-shadow: var(--shadow-xs);
}
.chart-card-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--black);
    margin-bottom: 20px;
}

/* ── Stats Cards ──────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 28px;
}

/* ── Login Page ───────────────────────────────────────────────── */
.login-wrapper {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    background: linear-gradient(135deg, #f7f7f8 0%, #ebebed 100%);
}
.login-card {
    width: 100%;
    max-width: 420px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 44px 40px;
    box-shadow: var(--shadow-xl);
    animation: fadeInUp .5s ease both;
}
.login-logo {
    width: 52px; height: 52px;
    background: var(--black);
    border-radius: 16px;
    display: flex; align-items: center; justify-content: center;
    color: var(--white);
    font-size: 1.3rem;
    margin: 0 auto 24px;
}
.login-title {
    font-size: 1.6rem;
    font-weight: 800;
    letter-spacing: -.4px;
    color: var(--black);
    margin-bottom: 4px;
    text-align: center;
}
.login-sub {
    font-size: .9rem;
    color: var(--text-secondary);
    margin-bottom: 32px;
    text-align: center;
}
.form-label-custom {
    display: block;
    font-size: .8rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--text-secondary);
    margin-bottom: 6px;
}
.form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1.5px solid var(--border);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: .95rem;
    color: var(--black);
    background: var(--surface);
    outline: none;
    transition: var(--transition);
}
.form-input:focus { border-color: var(--black); box-shadow: 0 0 0 3px rgba(17,17,17,.06); }
.form-input.is-invalid { border-color: var(--danger); }
.form-group { margin-bottom: 20px; }
.btn-login {
    width: 100%;
    padding: 14px;
    background: var(--black);
    color: var(--white);
    border: none;
    border-radius: var(--radius-pill);
    font-family: inherit;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.btn-login:hover { background: #333; box-shadow: var(--shadow-md); }
.btn-login:active { transform: scale(.98); }
.login-error {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: .875rem;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex;
    align-items: center;
    gap: 8px;
}
.remember-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 20px;
}
.remember-row input[type=checkbox] { accent-color: var(--black); width: 16px; height: 16px; }
.remember-row label { font-size: .875rem; color: var(--text-secondary); cursor: pointer; }

/* ── Toast Notifications ──────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px 18px;
    background: var(--black);
    color: var(--white);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: .875rem;
    font-weight: 500;
    min-width: 280px;
    max-width: 380px;
    pointer-events: all;
    animation: slideInToast .3s ease;
    transition: opacity .3s ease, transform .3s ease;
}
.toast-item.success { background: var(--success); }
.toast-item.error   { background: var(--danger); }
.toast-item.info    { background: var(--info); }
.toast-item.hiding  { opacity: 0; transform: translateX(20px); }
.toast-icon { font-size: 1.1rem; flex-shrink: 0; }
.toast-close {
    margin-left: auto;
    background: none;
    border: none;
    color: rgba(255,255,255,.7);
    cursor: pointer;
    font-size: 1rem;
    line-height: 1;
    flex-shrink: 0;
    transition: var(--transition);
    padding: 0;
}
.toast-close:hover { color: #fff; }

/* ── Pagination ───────────────────────────────────────────────── */
.pagination-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 20px;
}
.page-btn {
    min-width: 36px; height: 36px;
    padding: 0 10px;
    border-radius: 10px;
    font-family: inherit;
    font-size: .85rem;
    font-weight: 600;
    background: var(--surface-2);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    cursor: pointer;
    transition: var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.page-btn:hover  { border-color: var(--black); color: var(--black); }
.page-btn.active { background: var(--black); color: var(--white); border-color: var(--black); }
.page-btn:disabled { opacity: .4; cursor: not-allowed; }

/* ── Modal overrides ──────────────────────────────────────────── */
.modal-content {
    border-radius: var(--radius);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-xl);
}
.modal-header {
    border-bottom: 1px solid var(--border);
    padding: 20px 24px;
}
.modal-title { font-weight: 700; font-size: 1rem; }
.modal-body { padding: 24px; }
.modal-footer { border-top: 1px solid var(--border); padding: 16px 24px; }
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    font-size: .9rem;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-secondary); font-weight: 500; }
.detail-value { font-weight: 700; color: var(--black); }

/* ── Profile form ─────────────────────────────────────────────── */
.profile-card {
    max-width: 560px;
}
.section-divider {
    border: none;
    border-top: 1px solid var(--border);
    margin: 28px 0;
}
.success-alert {
    background: var(--success-bg);
    border: 1px solid var(--success-border);
    color: var(--success);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: .875rem;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex; align-items: center; gap: 8px;
}
.error-alert {
    background: var(--danger-bg);
    border: 1px solid var(--danger-border);
    color: var(--danger);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    font-size: .875rem;
    font-weight: 500;
    margin-bottom: 20px;
    display: flex; align-items: center; gap: 8px;
}

/* ── Empty State ──────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 60px 20px;
    color: var(--text-tertiary);
}
.empty-state-icon { font-size: 3rem; margin-bottom: 12px; }
.empty-state-text { font-size: .95rem; font-weight: 500; }

/* ── Animations ───────────────────────────────────────────────── */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes spin {
    to { transform: rotate(360deg); }
}
@keyframes pulseDot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: .5; transform: scale(1.3); }
}
@keyframes slideInToast {
    from { opacity: 0; transform: translateX(30px); }
    to   { opacity: 1; transform: translateX(0); }
}

/* staggered card animation */
.summary-grid .card:nth-child(1) { animation: fadeInUp .4s .1s ease both; }
.summary-grid .card:nth-child(2) { animation: fadeInUp .4s .18s ease both; }
.summary-grid .card:nth-child(3) { animation: fadeInUp .4s .26s ease both; }
.summary-grid .card:nth-child(4) { animation: fadeInUp .4s .34s ease both; }

/* ── Responsive ───────────────────────────────────────────────── */

/* ≤ 1024px — sidebar becomes slide-in overlay, mobile topbar shown */
@media (max-width: 1024px) {
    /* Sidebar: off-screen by default, slides in when .open */
    .sidebar {
        transform: translateX(-100%);
        z-index: 1001;
        box-shadow: none;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: var(--shadow-xl);
    }

    /* Show mobile top bar & hamburger */
    .mobile-topbar { display: flex; }
    .nav-toggle    { display: flex; }

    /* Content: no sidebar offset, offset for top bar height */
    .main-content {
        margin-left: 0;
        padding-top: var(--nav-height);
    }

    /* Grid tweaks */
    .summary-grid { grid-template-columns: repeat(2, 1fr); }
    .stats-grid   { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .page-wrapper  { padding: 28px 16px 48px; }
    .page-greeting { font-size: 1.4rem; }
    .status-card   { padding: 20px; }
    .login-card    { padding: 32px 24px; }
    .summary-grid  { grid-template-columns: repeat(2, 1fr); }
    .stats-grid    { grid-template-columns: 1fr 1fr; }
    .btn-action    { width: 100%; }

    .header-with-filter { flex-direction: column; align-items: stretch !important; gap: 16px; }
    .date-filter-form   { flex-direction: column; align-items: stretch !important; gap: 12px; }
    .date-filter-form > div { justify-content: space-between; width: 100%; }
    .filter-date-input  { flex: 1; }
    .filter-btn-group   { display: grid !important; grid-template-columns: 1fr 1fr; width: 100%; }
    .filter-btn-group button { justify-content: center; width: 100%; }
}

@media (max-width: 480px) {
    .summary-grid     { grid-template-columns: 1fr 1fr; }
    .stats-grid       { grid-template-columns: 1fr 1fr; }
}

/* ── Printable Report Styles (A4 Template) ────────────────────── */
.print-template { display: none; }

@media print {
    @page {
        size: A4;
        margin: 15mm;
    }
    html, body {
        width: 100%;
        height: auto !important;
        margin: 0 !important;
        padding: 0 !important;
        background: #ffffff !important;
        overflow: visible !important;
    }
    .sidebar, .mobile-topbar, .page-wrapper, .toast-container {
        display: none !important;
    }
    .main-content {
        margin: 0 !important;
        padding: 0 !important;
        width: 100% !important;
        display: block !important;
    }
    #printableReport {
        display: block !important;
        position: static !important;
        width: 100%;
        background: #ffffff !important;
        color: #111111 !important;
        font-family: 'Inter', -apple-system, sans-serif;
        padding: 0;
        margin: 0;
    }
    .print-header {
        display: flex;
        justify-content: space-between;
        align-items: flex-start;
        border-bottom: 2px solid #000000;
        padding-bottom: 16px;
        margin-bottom: 24px;
    }
    .print-doc-title {
        font-size: 24px;
        font-weight: 800;
        letter-spacing: -0.5px;
        margin: 0 0 8px;
        color: #000;
    }
    .print-user-info { font-size: 14px; color: #222; margin-bottom: 2px; }
    .print-user-sub  { font-size: 13px; color: #666; }
    .print-meta-info {
        text-align: right;
        font-size: 12px;
        color: #444;
        line-height: 1.6;
    }

    .print-highlights {
        display: grid;
        grid-template-columns: repeat(4, 1fr);
        gap: 12px;
        margin-bottom: 24px;
    }
    .print-hl-box {
        border: 1px solid #cccccc;
        border-radius: 8px;
        padding: 12px 8px;
        text-align: center;
        background: #fcfcfc !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .print-hl-box span {
        display: block;
        font-size: 10px;
        font-weight: 700;
        text-transform: uppercase;
        color: #666666;
        margin-bottom: 4px;
    }
    .print-hl-box strong {
        font-size: 18px;
        font-weight: 800;
        color: #000000;
    }

    .print-summary-card {
        border: 1px solid #111111;
        border-radius: 8px;
        padding: 16px 20px;
        margin-bottom: 28px;
    }
    .print-summary-title {
        font-size: 13px;
        font-weight: 800;
        text-transform: uppercase;
        letter-spacing: 0.5px;
        border-bottom: 1px solid #e5e5e5;
        padding-bottom: 8px;
        margin-bottom: 12px;
        color: #000;
    }
    .print-summary-grid {
        display: grid;
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
        font-size: 13px;
    }
    .print-sum-item span { color: #555555; }
    .print-sum-item strong { color: #000000; font-weight: 700; }

    .print-data-table {
        width: 100%;
        border-collapse: collapse;
        margin-bottom: 40px;
        font-size: 12px;
    }
    .print-data-table th {
        background: #111111 !important;
        color: #ffffff !important;
        font-weight: 700;
        text-align: left;
        padding: 10px 12px;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }
    .print-data-table td {
        padding: 10px 12px;
        border-bottom: 1px solid #e0e0e0;
        color: #111111;
    }
    .print-data-table tr:nth-child(even) td {
        background: #f9f9f9 !important;
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
    }

    .print-footer {
        text-align: center;
        font-size: 10px;
        color: #888888;
        border-top: 1px solid #eeeeee;
        padding-top: 16px;
    }
}

