/* Import Google Fonts - Professional & Modern */
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@300;400;500;600;700&family=DM+Mono:wght@400;500&display=swap');


:root {
    --color-bg: #F4F8F8;
    --color-surface: #FFFFFF;
    --color-ink: #16232B;
    --color-muted: #6B7B7D;
    --color-primary: #1e7366;
    --color-primary-dark: #0f2744;
    --color-primary-light: #E4F0EF;
    --color-accent: #1e7366;
    --color-accent-dark: #C97F1E;
    --color-accent-light: #FDF1DE;
    --color-success: #2F9E63;
    --color-danger: #D64545;
    --color-halfday: #3E7CB1;

    /* Compact, professional geometry -- replaces the old oversized touch-first values */
    --radius-sm: 8px;
    --radius-md: 10px;
    --radius-lg: 14px;
    --radius-badge: 8px;
    --control-height: 38px;
    --control-height-sm: 32px;
    --shadow-card: 0 1px 2px rgba(16,35,40,0.05), 0 1px 6px rgba(16,35,40,0.04);
    --shadow-lift: 0 10px 28px rgba(7,59,64,0.14);
    --shadow-ring: 0 0 0 3px rgba(14,92,99,0.14);
    --ease: cubic-bezier(.4,0,.2,1);
}

* { box-sizing: border-box; }

body {
    background: var(--color-bg);
    color: var(--color-ink);
    font-family: 'DM Sans', sans-serif;
    font-size: 14.5px;
    line-height: 1.5;
    -webkit-font-smoothing: antialiased;
}

/* ---------- Type scale ---------- */
h1, h2, h3, h4, .font-display {
    font-family: 'DM Sans', sans-serif;;
    color: var(--color-primary-dark);
    letter-spacing: -0.01em;
}
h1 { font-size: 1.5rem;  font-weight: 700; line-height: 1.25; }
h2 { font-size: 1.2rem;  font-weight: 700; line-height: 1.3; }
h3 { font-size: 1.02rem; font-weight: 600; line-height: 1.35; }
h4 { font-size: 0.9rem;  font-weight: 600; line-height: 1.4; }

.font-mono { font-family: 'DM Mono', monospace;; }
.text-muted-custom { color: var(--color-muted) !important; }
.text-primary-custom { color: var(--color-primary) !important; }

.eyebrow {
    font-family: 'DM Mono', monospace;;
    font-size: 0.68rem;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--color-muted);
}

small, .small { font-size: 0.8rem; }

/* ---------- Inputs: compact, precise, still comfortable to tap ---------- */
.form-control, .form-select {
    min-height: var(--control-height);
    height: var(--control-height);
    border-radius: var(--radius-md);
    border: 1px solid #DEE6E9;
    padding: 0.4rem 0.7rem;
    font-size: 0.875rem;
    background-color: #fff;
    transition: border-color .15s var(--ease), box-shadow .15s var(--ease);
}
.form-control:focus, .form-select:focus {
    border-color: var(--color-primary);
    box-shadow: var(--shadow-ring);
}
.form-control::placeholder { color: #9AA8AA; font-size: 0.85rem; }
textarea.form-control { min-height: 76px; height: auto; padding: 0.55rem 0.7rem; }
select.form-select { height: var(--control-height); }

.form-control-sm, .form-select-sm {
    min-height: var(--control-height-sm);
    height: var(--control-height-sm);
    font-size: 0.8rem;
    padding: 0.25rem 0.55rem;
    border-radius: var(--radius-sm);
}

label, .form-label {
    font-weight: 600;
    font-size: 0.78rem;
    color: var(--color-ink);
    margin-bottom: 0.3rem;
    letter-spacing: 0.01em;
}
.form-text { font-size: 0.75rem; margin-top: 0.25rem; }

.form-check-input {
    width: 1.05rem; height: 1.05rem; margin-top: 0.15rem;
    border-color: #C7D2D5;
}
.form-check-input:checked { background-color: var(--color-primary); border-color: var(--color-primary); }
.form-check-label { font-size: 0.85rem; font-weight: 500; }

/* Tighter, denser field rhythm -- kills the "too much space" feeling */
.mb-3 { margin-bottom: 0.85rem !important; }
.row.g-3 { --bs-gutter-y: 0.85rem; }
.row.g-4 { --bs-gutter-y: 1.1rem; }

/* ---------- Buttons ---------- */
.btn {
    font-size: 0.85rem;
    border-radius: var(--radius-md);
    transition: transform .12s var(--ease), box-shadow .12s var(--ease), background-color .15s var(--ease), color .15s var(--ease);
}
.btn:active { transform: translateY(1px); }

.btn-brand-primary {
    background: var(--color-primary); color: #fff; border: none;
    padding: 0.55rem 1.1rem; font-weight: 600;
    min-height: var(--control-height); box-shadow: var(--shadow-card);
}
.btn-brand-primary:hover { background: var(--color-primary-dark); color: #fff; box-shadow: 0 4px 12px rgba(7,59,64,0.22); }
.btn-brand-primary:focus-visible { outline: none; box-shadow: var(--shadow-ring); }

.btn-brand-accent {
    background: var(--color-accent); color: #fff; border: none;
    padding: 0.55rem 1.1rem; font-weight: 600;
    min-height: var(--control-height); box-shadow: var(--shadow-card);
}
.btn-brand-accent:hover { background: var(--color-accent-dark); color: #fff; box-shadow: 0 4px 12px rgba(201,127,30,0.25); }

.btn-brand-ghost {
    background: #fff; color: var(--color-ink); border: 1px solid #DEE6E9;
    padding: 0.55rem 1.1rem; font-weight: 600;
    min-height: var(--control-height);
}
.btn-brand-ghost:hover { border-color: var(--color-primary); color: var(--color-primary); background: var(--color-primary-light); }

.btn-brand-danger-outline {
    background: #fff; color: var(--color-danger); border: 1px solid rgba(214,69,69,.28);
    border-radius: var(--radius-md); padding: 0.55rem 1.1rem; font-weight: 600; min-height: var(--control-height);
}
.btn-brand-danger-outline:hover { background: rgba(214,69,69,.06); }

.btn-sm.btn-brand-primary, .btn-sm.btn-brand-ghost, .btn-sm.btn-brand-accent, .btn-sm.btn-brand-danger-outline {
    min-height: var(--control-height-sm); padding: 0.3rem 0.75rem; font-size: 0.78rem; border-radius: var(--radius-sm);
}

/* Icon-in-button alignment */
.btn-icon-left { display: inline-flex; align-items: center; gap: 0.45rem; }

/* ---------- Badge card (signature element) ---------- */
.badge-card {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.85rem;
    background: var(--color-surface);
    border-radius: var(--radius-badge);
    border: 1px solid #EEF2F3;
    box-shadow: var(--shadow-card);
    padding: 0.85rem 0.9rem 0.85rem 1.1rem;
    overflow: hidden;
    height: 100%;
    transition: box-shadow .18s var(--ease), transform .18s var(--ease);
}
.badge-card:hover { box-shadow: var(--shadow-lift); transform: translateY(-1px); }
.badge-card::before {
    content: '';
    position: absolute; left: 0; top: 0; height: 100%; width: 4px;
    background: var(--color-primary);
}
.badge-card--accent::before { background: var(--color-accent); }
.badge-card--success::before { background: var(--color-success); }
.badge-card--danger::before { background: var(--color-danger); }

/* ---------- Section cards ---------- */
.section-card {
    background: var(--color-surface);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    border: 1px solid #EEF2F3;
    padding: 1.15rem 1.25rem;
}
.section-card.no-pad { padding: 0; }
.section-card + .section-card { margin-top: 1rem; }
.section-card-header {
    display: flex; align-items: center; justify-content: space-between;
    padding-bottom: 0.75rem; margin-bottom: 0.9rem; border-bottom: 1px solid #EEF2F3;
}

/* ---------- Pills ---------- */
.pill {
    display: inline-flex; align-items: center; font-size: 0.68rem; border-radius: 999px;
    padding: 0.18rem 0.6rem; font-weight: 700; letter-spacing: 0.01em;
}
.pill-primary { background: var(--color-primary-light); color: var(--color-primary-dark); }
.pill-accent { background: var(--color-accent-light); color: var(--color-accent-dark); }
.pill-success { background: rgba(47,158,99,0.13); color: var(--color-success); }
.pill-danger { background: rgba(214,69,69,0.13); color: var(--color-danger); }
.pill-muted { background: #E9EEEF; color: var(--color-muted); }

/* ---------- Tables ---------- */
.table { font-size: 0.85rem; }
.table thead th {
    font-family: 'DM Sans', monospace;;
    font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.06em;
    color: var(--color-muted); font-weight: 600;
    border-bottom-width: 1px; padding: 0.6rem 0.75rem;
}
.table td { padding: 0.6rem 0.75rem; vertical-align: middle; }
.table-hover tbody tr:hover { background: var(--color-primary-light); }

/* ---------- Layout: desktop sidebar ---------- */
.app-sidebar {
    width: 224px;
    background: var(--color-primary-dark);
    color: #fff;
    min-height: 100vh;
    flex-shrink: 0;
}
.app-sidebar .nav-link {
    color: rgba(255,255,255,0.68);
    border-radius: 8px;
    padding: 0.5rem 0.75rem;
    font-weight: 500;
    font-size: 0.83rem;
    transition: background-color .15s var(--ease), color .15s var(--ease), padding-left .15s var(--ease);
}
.app-sidebar .nav-link:hover { background: rgba(255,255,255,0.06); color: #fff; padding-left: 0.95rem; }
.app-sidebar .nav-link.active { background: rgba(255,255,255,0.12); color: #fff; }
.app-sidebar .nav-link span:first-child { font-size: 0.95rem; }

/* Mobile top app bar + bottom tab bar */
.app-topbar {
    background: var(--color-primary-dark); color: #fff;
    position: sticky; top: 0; z-index: 30; box-shadow: var(--shadow-lift);
    padding: 0.75rem 1rem !important;
}
.app-bottom-nav {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 30;
    background: #fff; border-top: 1px solid #E2E8ED; box-shadow: var(--shadow-lift);
    padding-bottom: env(safe-area-inset-bottom);
}
.app-bottom-nav a {
    color: var(--color-muted); text-decoration: none; font-size: 0.66rem; font-weight: 600;
    transition: color .15s var(--ease);
}
.app-bottom-nav a.active { color: var(--color-primary); }
.app-bottom-nav .tab-icon { font-size: 1.1rem; line-height: 1; display: block; margin-bottom: 0.1rem; }

/* ---------- Attendance grid ---------- */
.att-table th, .att-table td { vertical-align: middle; }
.att-table thead th {
    background: var(--color-primary-dark); color: #fff; text-align: center;
    position: sticky; top: 0; font-family: 'DM Sans', monospace;;
    font-size: 0.65rem; letter-spacing: 0.05em;
}
.att-table .emp-col {
    position: sticky; left: 0; background: #fff; z-index: 2; min-width: 170px;
    font-size: 0.85rem;
}
.att-table thead .emp-col { background: var(--color-primary-dark); z-index: 3; text-align: left; }
.att-cell-btn {
    width: 36px; height: 36px; border-radius: 8px; border: none;
    font-weight: 700; font-size: 0.68rem; display: flex; flex-direction: column;
    align-items: center; justify-content: center; line-height: 1;
    transition: transform .12s var(--ease), box-shadow .12s var(--ease);
}
.att-cell-btn:hover { transform: scale(1.08); box-shadow: 0 2px 6px rgba(16,35,40,0.15); }
.att-cell-btn small { font-weight: 500; font-size: 0.55rem; }
.att-status-present { background: rgba(47,158,99,0.15); color: var(--color-success); }
.att-status-absent { background: rgba(214,69,69,0.15); color: var(--color-danger); }
.att-status-halfday { background: rgba(62,124,177,0.15); color: var(--color-halfday); }
.att-status-off { background: #E9EEEF; color: var(--color-muted); }
.att-status-empty { background: #F7FAFA; color: var(--color-muted); }

/* ---------- Scrollbar polish (desktop) ---------- */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: #C7D2D5; border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: #9AA8AA; }

@media (max-width: 767px) {
    .app-sidebar { display: none; }
    main.app-main { padding-bottom: 6rem; padding-top: 1.1rem; }
    .section-card { padding: 1rem; border-radius: var(--radius-md); }
    h1 { font-size: 1.3rem; }
}
@media (min-width: 768px) {
    .app-topbar, .app-bottom-nav { display: none; }
}
@media print {
    .app-sidebar, .app-topbar, .app-bottom-nav, .no-print { display: none !important; }
}