/* ============================================================
   Inway Hosting – Attendance App  |  style.css
   Mobile-first, CSS custom properties, no frameworks
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

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

:root {
  --brand:       #1a56db;
  --brand-dark:  #1341b0;
  --brand-light: #e8f0fd;
  --accent:      #0ea5e9;
  --success:     #16a34a;
  --success-bg:  #dcfce7;
  --warning:     #d97706;
  --warning-bg:  #fef3c7;
  --danger:      #dc2626;
  --danger-bg:   #fee2e2;
  --gray-50:     #f9fafb;
  --gray-100:    #f3f4f6;
  --gray-200:    #e5e7eb;
  --gray-300:    #d1d5db;
  --gray-400:    #9ca3af;
  --gray-500:    #6b7280;
  --gray-600:    #4b5563;
  --gray-700:    #374151;
  --gray-800:    #1f2937;
  --gray-900:    #111827;
  --white:       #ffffff;
  --radius:      10px;
  --radius-lg:   16px;
  --shadow-sm:   0 1px 3px rgba(0,0,0,.08);
  --shadow:      0 4px 16px rgba(0,0,0,.10);
  --shadow-lg:   0 8px 32px rgba(0,0,0,.14);
  --font:        'Inter', system-ui, sans-serif;
  --nav-h:       64px;
}

html { scroll-behavior: smooth; }
body { font-family: var(--font); font-size: 15px; color: var(--gray-800); background: var(--gray-50); min-height: 100vh; }
a { color: var(--brand); text-decoration: none; }
img { max-width: 100%; }
input, select, textarea, button { font-family: var(--font); }

.hidden   { display: none !important; }
.sr-only  { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-center { text-align: center; }

/* ── Login shell ── */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a56db 0%, #0ea5e9 100%);
  padding: 1.5rem;
}
.login-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
}
.login-logo { text-align: center; margin-bottom: 1.75rem; }
.login-logo .brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 56px; height: 56px;
  background: var(--brand); border-radius: 14px; margin-bottom: .75rem;
}
.login-logo .brand-mark svg { width: 28px; height: 28px; fill: var(--white); }
.login-logo h1 { font-size: 1.25rem; font-weight: 700; color: var(--gray-900); }
.login-logo p  { font-size: .85rem; color: var(--gray-500); margin-top: .25rem; }

/* ── App shell ── */
.app-shell { display: flex; min-height: 100vh; }

/* ── Sidebar ── */
.sidebar {
  width: 240px; background: var(--gray-900); color: var(--white);
  display: flex; flex-direction: column;
  position: fixed; top: 0; left: 0; height: 100vh; z-index: 200;
  transform: translateX(-100%); transition: transform .25s ease;
}
.sidebar.open { transform: translateX(0); }
@media (min-width: 900px) { .sidebar { transform: translateX(0); position: sticky; flex-shrink: 0; } }
.sidebar-header {
  display: flex; align-items: center; gap: .75rem;
  padding: 1.25rem 1.25rem 1rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-header .mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; background: var(--brand); border-radius: 9px; flex-shrink: 0;
}
.sidebar-header .mark svg { width: 18px; height: 18px; fill: #fff; }
.sidebar-header span { font-weight: 700; font-size: .95rem; line-height: 1.2; }
.sidebar-header small { display: block; font-size: .72rem; color: var(--gray-400); font-weight: 400; }

.sidebar-nav { flex: 1; padding: 1rem 0; overflow-y: auto; }
.sidebar-nav a {
  display: flex; align-items: center; gap: .75rem;
  padding: .65rem 1.25rem; color: var(--gray-400);
  font-size: .875rem; font-weight: 500;
  border-left: 3px solid transparent; transition: all .15s;
}
.sidebar-nav a svg { width: 18px; height: 18px; flex-shrink: 0; }
.sidebar-nav a:hover  { color: var(--white); background: rgba(255,255,255,.06); }
.sidebar-nav a.active { color: var(--white); border-left-color: var(--brand); background: rgba(26,86,219,.18); }
.sidebar-section {
  padding: .5rem 1.25rem .25rem; font-size: .7rem; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase; color: var(--gray-600); margin-top: .5rem;
}
.sidebar-footer { padding: 1rem 1.25rem; border-top: 1px solid rgba(255,255,255,.08); }
.user-chip { display: flex; align-items: center; gap: .65rem; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--brand);
  display: flex; align-items: center; justify-content: center;
  font-size: .8rem; font-weight: 700; color: var(--white); flex-shrink: 0;
}
.user-chip .info { flex: 1; min-width: 0; }
.user-chip .info strong { display: block; font-size: .8rem; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-chip .info span  { font-size: .7rem; color: var(--gray-400); }
.btn-logout {
  background: none; border: none; cursor: pointer; color: var(--gray-500);
  padding: .25rem; border-radius: 6px; display: flex; transition: color .15s;
}
.btn-logout:hover { color: var(--danger); }

/* ── Main content area ── */
.main-wrap { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.topbar {
  height: var(--nav-h); background: var(--white); border-bottom: 1px solid var(--gray-200);
  display: flex; align-items: center; padding: 0 1.5rem; gap: 1rem;
  position: sticky; top: 0; z-index: 100;
}
.btn-menu {
  background: none; border: none; cursor: pointer; display: flex;
  align-items: center; color: var(--gray-600); padding: .3rem;
  border-radius: 7px; transition: background .15s;
}
.btn-menu:hover { background: var(--gray-100); }
@media (min-width: 900px) { .btn-menu { display: none; } }
.topbar-title { font-weight: 600; font-size: 1rem; color: var(--gray-800); flex: 1; }
.topbar-right { display: flex; align-items: center; gap: .75rem; }
.topbar-date   { font-size: .8rem; color: var(--gray-500); }

.page-content { padding: 1.5rem; flex: 1; }
@media (min-width: 640px) { .page-content { padding: 2rem; } }
.page-header { margin-bottom: 1.5rem; }
.page-header h2 { font-size: 1.4rem; font-weight: 700; color: var(--gray-900); }
.page-header p  { font-size: .875rem; color: var(--gray-500); margin-top: .25rem; }

/* ── Stat cards ── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 1rem; margin-bottom: 1.5rem; }
.stat-card {
  background: var(--white); border-radius: var(--radius); padding: 1.25rem;
  box-shadow: var(--shadow-sm); border: 1px solid var(--gray-200);
  display: flex; flex-direction: column; gap: .5rem;
}
.stat-card .stat-icon { width: 40px; height: 40px; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.stat-card .stat-icon svg { width: 20px; height: 20px; }
.stat-card .stat-value { font-size: 1.75rem; font-weight: 700; color: var(--gray-900); line-height: 1; }
.stat-card .stat-label { font-size: .78rem; color: var(--gray-500); font-weight: 500; }
.stat-card .stat-sub   { font-size: .75rem; color: var(--gray-400); }
.icon-blue   { background: #dbeafe; color: #1d4ed8; }
.icon-green  { background: var(--success-bg); color: var(--success); }
.icon-amber  { background: var(--warning-bg); color: var(--warning); }
.icon-red    { background: var(--danger-bg); color: var(--danger); }
.icon-purple { background: #ede9fe; color: #7c3aed; }

/* ── Cards ── */
.card { background: var(--white); border: 1px solid var(--gray-200); border-radius: var(--radius); box-shadow: var(--shadow-sm); margin-bottom: 1.5rem; overflow: hidden; }
.card-header { padding: 1rem 1.25rem; border-bottom: 1px solid var(--gray-100); display: flex; align-items: center; justify-content: space-between; gap: .75rem; flex-wrap: wrap; }
.card-header h3 { font-size: .95rem; font-weight: 600; color: var(--gray-800); }
.card-body { padding: 1.25rem; }

/* ── Clock card ── */
.clock-card {
  background: linear-gradient(135deg, var(--brand) 0%, var(--accent) 100%);
  color: var(--white); border-radius: var(--radius-lg); padding: 2rem 1.5rem;
  margin-bottom: 1.5rem; display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center;
}
.clock-card .live-time { font-size: 3rem; font-weight: 700; letter-spacing: -.03em; line-height: 1; }
.clock-card .live-date { font-size: .9rem; opacity: .8; }
.clock-card .clock-actions { display: flex; gap: .75rem; flex-wrap: wrap; justify-content: center; }
.clock-card .status-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  background: rgba(255,255,255,.2); border-radius: 20px; padding: .3rem .85rem;
  font-size: .8rem; font-weight: 500;
}

/* ── Buttons ── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .6rem 1.25rem; border-radius: 8px; font-size: .875rem; font-weight: 600;
  cursor: pointer; border: none; transition: all .15s; line-height: 1;
}
.btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-primary { background: var(--brand); color: var(--white); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-success { background: var(--success); color: var(--white); }
.btn-success:hover { background: #15803d; }
.btn-danger  { background: var(--danger); color: var(--white); }
.btn-danger:hover  { background: #b91c1c; }
.btn-warning { background: var(--warning); color: var(--white); }
.btn-outline { background: transparent; border: 1.5px solid var(--gray-300); color: var(--gray-700); }
.btn-outline:hover { border-color: var(--brand); color: var(--brand); background: var(--brand-light); }
.btn-ghost { background: transparent; color: var(--gray-600); }
.btn-ghost:hover { background: var(--gray-100); color: var(--gray-900); }
.btn-sm { padding: .4rem .85rem; font-size: .8rem; }
.btn-lg { padding: .85rem 1.75rem; font-size: 1rem; }
.btn-white { background: var(--white); color: var(--brand); }
.btn-white:hover { background: var(--brand-light); }
.btn:disabled { opacity: .55; cursor: not-allowed; }

/* ── Forms ── */
.form-group { margin-bottom: 1.1rem; }
.form-label { display: block; font-size: .82rem; font-weight: 600; color: var(--gray-700); margin-bottom: .4rem; }
.form-control {
  width: 100%; padding: .6rem .9rem;
  border: 1.5px solid var(--gray-300); border-radius: 8px;
  font-size: .875rem; color: var(--gray-800); background: var(--white);
  transition: border-color .15s, box-shadow .15s; appearance: none;
}
.form-control:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(26,86,219,.12); }
.form-control.error { border-color: var(--danger); }
.form-hint  { font-size: .75rem; color: var(--gray-400); margin-top: .3rem; }
.form-error { font-size: .75rem; color: var(--danger); margin-top: .3rem; }
.form-row { display: grid; gap: 1rem; }
@media (min-width: 600px) { .form-row.cols-2 { grid-template-columns: 1fr 1fr; } }

/* ── Tables ── */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .85rem; }
thead th {
  text-align: left; padding: .75rem 1rem; font-size: .75rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .05em; color: var(--gray-500);
  background: var(--gray-50); border-bottom: 1px solid var(--gray-200); white-space: nowrap;
}
tbody td { padding: .8rem 1rem; border-bottom: 1px solid var(--gray-100); color: var(--gray-700); }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--gray-50); }

/* ── Badges ── */
.badge { display: inline-flex; align-items: center; padding: .2rem .65rem; border-radius: 20px; font-size: .72rem; font-weight: 600; }
.badge-present  { background: var(--success-bg); color: #15803d; }
.badge-absent   { background: var(--danger-bg);  color: #b91c1c; }
.badge-wfh      { background: #dbeafe;            color: #1d4ed8; }
.badge-late     { background: var(--warning-bg);  color: #92400e; }
.badge-pending  { background: var(--warning-bg);  color: #92400e; }
.badge-approved { background: var(--success-bg);  color: #15803d; }
.badge-rejected { background: var(--danger-bg);   color: #b91c1c; }

/* ── Alerts ── */
.alert { display: flex; align-items: flex-start; gap: .75rem; padding: .9rem 1rem; border-radius: var(--radius); font-size: .875rem; margin-bottom: 1rem; }
.alert svg { width: 18px; height: 18px; flex-shrink: 0; margin-top: .05rem; }
.alert-success { background: var(--success-bg); color: #15803d; }
.alert-danger  { background: var(--danger-bg);  color: #b91c1c; }
.alert-info    { background: var(--brand-light); color: var(--brand); }

/* ── Modal ── */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 500;
  display: flex; align-items: center; justify-content: center; padding: 1rem;
  opacity: 0; pointer-events: none; transition: opacity .2s;
}
.modal-backdrop.open { opacity: 1; pointer-events: auto; }
.modal {
  background: var(--white); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 480px; padding: 1.75rem;
  transform: translateY(16px); transition: transform .2s;
}
.modal-backdrop.open .modal { transform: translateY(0); }
.modal-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1.25rem; }
.modal-header h3 { font-size: 1rem; font-weight: 700; }
.modal-close { background: none; border: none; cursor: pointer; color: var(--gray-400); display: flex; padding: .2rem; border-radius: 6px; }
.modal-close:hover { color: var(--gray-700); background: var(--gray-100); }
.modal-footer { margin-top: 1.5rem; display: flex; justify-content: flex-end; gap: .75rem; flex-wrap: wrap; }

/* ── Sidebar overlay (mobile) ── */
.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 190; }
.sidebar-overlay.open { display: block; }
@media (min-width: 900px) { .sidebar-overlay { display: none !important; } }

/* ── Timeline ── */
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item { display: flex; gap: 1rem; padding-bottom: 1.25rem; position: relative; }
.timeline-item:not(:last-child)::before { content: ''; position: absolute; left: 15px; top: 32px; bottom: 0; width: 2px; background: var(--gray-200); }
.timeline-dot { width: 32px; height: 32px; border-radius: 50%; display: flex; align-items: center; justify-content: center; flex-shrink: 0; z-index: 1; }
.timeline-dot svg { width: 15px; height: 15px; }
.timeline-content { flex: 1; padding-top: .35rem; }
.timeline-content strong { display: block; font-size: .875rem; font-weight: 600; color: var(--gray-800); }
.timeline-content span   { font-size: .78rem; color: var(--gray-500); }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 3rem 1.5rem; color: var(--gray-400); }
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 1rem; display: block; opacity: .4; }
.empty-state p { font-size: .9rem; }

/* ── Progress ── */
.progress { height: 6px; background: var(--gray-200); border-radius: 99px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--brand); border-radius: 99px; transition: width .4s; }

/* ── Calendar strip ── */
.cal-strip { display: flex; gap: .5rem; overflow-x: auto; padding-bottom: .5rem; scrollbar-width: none; }
.cal-strip::-webkit-scrollbar { display: none; }
.cal-day { flex-shrink: 0; width: 44px; display: flex; flex-direction: column; align-items: center; gap: .2rem; padding: .5rem .25rem; border-radius: 10px; cursor: pointer; border: 1.5px solid transparent; transition: all .15s; }
.cal-day .day-name { font-size: .65rem; font-weight: 600; color: var(--gray-400); text-transform: uppercase; }
.cal-day .day-num  { font-size: .95rem; font-weight: 600; color: var(--gray-700); }
.cal-day .day-dot  { width: 6px; height: 6px; border-radius: 50%; }
.cal-day:hover { background: var(--gray-100); }
.cal-day.today { border-color: var(--brand); background: var(--brand-light); }
.cal-day.today .day-num { color: var(--brand); }
.cal-day.today .day-name { color: var(--brand); }

/* ── Tabs ── */
.tabs { display: flex; border-bottom: 1.5px solid var(--gray-200); margin-bottom: 1.5rem; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab-btn { padding: .7rem 1.1rem; font-size: .85rem; font-weight: 600; color: var(--gray-500); border: none; background: none; cursor: pointer; border-bottom: 2.5px solid transparent; white-space: nowrap; margin-bottom: -1.5px; transition: all .15s; }
.tab-btn:hover  { color: var(--gray-800); }
.tab-btn.active { color: var(--brand); border-bottom-color: var(--brand); }
.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* ── Switch ── */
.switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.switch input { opacity: 0; width: 0; height: 0; }
.slider { position: absolute; cursor: pointer; inset: 0; background: var(--gray-300); border-radius: 24px; transition: .2s; }
.slider::before { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; bottom: 3px; background: white; border-radius: 50%; transition: .2s; }
input:checked + .slider { background: var(--brand); }
input:checked + .slider::before { transform: translateX(18px); }

/* ── Grid helpers ── */
.two-col { display: grid; gap: 1.5rem; }
@media (min-width: 768px) { .two-col { grid-template-columns: 1fr 1fr; } }
.three-col { display: grid; gap: 1rem; }
@media (min-width: 900px) { .three-col { grid-template-columns: 1fr 1fr 1fr; } }

/* ── Filter bar ── */
.filter-bar { display: flex; gap: .75rem; flex-wrap: wrap; align-items: center; margin-bottom: 1.25rem; }
.filter-bar .form-control { max-width: 200px; }
.search-box { position: relative; }
.search-box svg { position: absolute; left: .7rem; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--gray-400); }
.search-box input { padding-left: 2.1rem; }

/* ── Scrollbar ── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 99px; }

@media print { .sidebar, .topbar, .btn-menu { display: none; } }
