@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
  --bg: hsl(220, 33%, 98%);
  --fg: hsl(222, 47%, 11%);
  --card: hsl(0, 0%, 100%);
  --primary: hsl(224, 64%, 33%);
  --primary-fg: hsl(0, 0%, 100%);
  --primary-glow: hsl(218, 90%, 56%);
  --accent: hsl(0, 74%, 50%);
  --accent-fg: hsl(0, 0%, 100%);
  --secondary: hsl(220, 14%, 96%);
  --muted: hsl(220, 9%, 46%);
  --border: hsl(220, 13%, 91%);
  --destructive: hsl(0, 74%, 50%);
  --success: hsl(142, 71%, 45%);
  --radius: 1rem;
  --gradient-brand: linear-gradient(135deg, hsl(224,64%,33%) 0%, hsl(258,60%,40%) 50%, hsl(0,74%,50%) 100%);
  --gradient-hero: linear-gradient(135deg, hsl(224,70%,20%) 0%, hsl(224,64%,33%) 40%, hsl(0,74%,50%) 100%);
  --shadow-brand: 0 20px 60px -20px hsla(224,64%,33%,0.45);
  --shadow-card: 0 4px 24px -8px hsla(222,47%,11%,0.08);
  --sidebar-bg: hsl(222, 47%, 11%);
  --sidebar-fg: hsl(220, 14%, 96%);
}

* { margin: 0; padding: 0; box-sizing: border-box; border-color: var(--border); }
body { font-family: 'Inter', -apple-system, sans-serif; background: var(--bg); color: var(--fg); -webkit-font-smoothing: antialiased; min-height:100vh; }
h1,h2,h3,h4 { letter-spacing: -0.025em; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1200px; margin: 0 auto; padding: 0 1rem; }
.container-sm { max-width: 640px; margin: 0 auto; padding: 0 1rem; }

/* Top app bar (employee mobile) */
.app-bar { position: sticky; top: 0; z-index: 50; background: hsla(0,0%,100%,0.95); backdrop-filter: blur(20px); border-bottom: 1px solid var(--border); }
.app-bar .brand-strip { height: 4px; background: var(--gradient-brand); }
.app-bar-inner { display:flex; align-items:center; justify-content:space-between; padding: 0.75rem 1rem; }
.app-logo { font-weight:800; font-size:1.05rem; background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }
.app-user { display:flex; align-items:center; gap:0.5rem; background:var(--secondary); border-radius:999px; padding:0.25rem 0.5rem 0.25rem 0.25rem; cursor:pointer; }
.app-user .avatar-sm { width:2rem; height:2rem; }
.app-user-info { line-height:1.1; }
.app-user-info .n { font-size:0.8rem; font-weight:600; }
.app-user-info .id { font-size:0.7rem; color:var(--muted); font-family: monospace; }

/* Section wrapper */
.page { padding: 1.5rem 1rem 4rem; }
.page-section-label { display: inline-block; font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; padding: 0.25rem 0.75rem; border-radius: 999px; background: var(--gradient-brand); color: white; margin-bottom: 1.25rem; }

/* Cards */
.card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.card-flat { background: var(--card); border:1px solid var(--border); border-radius: var(--radius); }

/* Inputs */
.input, .select, textarea.input { width: 100%; height: 2.75rem; padding: 0 0.75rem; border: 1px solid var(--border); border-radius: 0.5rem; font-size: 0.875rem; background: white; outline: none; font-family: inherit; color: var(--fg); }
.input:focus, .select:focus, textarea.input:focus { border-color: var(--primary); box-shadow: 0 0 0 2px hsla(224,64%,33%,0.15); }
.label { font-size: 0.875rem; font-weight: 500; display: block; margin-bottom: 0.375rem; }
.label .req { color: var(--destructive); }
.help { font-size:0.75rem; color: var(--muted); margin-top:0.25rem; }
textarea.input { height: auto; padding: 0.75rem; resize: vertical; min-height: 5rem; }
.input[type="file"] { padding-top: 0.5rem; padding-bottom: 0.5rem; line-height: 1.6; }

/* Buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem; padding: 0.625rem 1.25rem; border-radius: 0.5rem; font-size: 0.875rem; font-weight: 600; border: none; cursor: pointer; transition: all 0.2s; text-decoration: none; font-family: inherit; }
.btn:disabled { opacity:0.6; cursor: not-allowed; }
.btn-brand { background: var(--gradient-brand); color: white; box-shadow: var(--shadow-brand); }
.btn-brand:hover { transform: translateY(-1px); }
.btn-outline { background: white; border: 1px solid var(--border); color: var(--fg); }
.btn-outline:hover { background: var(--secondary); }
.btn-destructive { background: var(--destructive); color: white; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--secondary); color: var(--fg); }
.btn-full { width: 100%; }
.btn-lg { height: 3.5rem; font-size: 1rem; }
.btn-sm { font-size: 0.75rem; padding: 0.375rem 0.75rem; }

/* Badge */
.badge { display: inline-block; padding: 0.125rem 0.5rem; border-radius: 999px; font-size: 0.7rem; font-weight: 600; }
.badge-brand { background: var(--gradient-brand); color: white; }
.badge-secondary { background: var(--secondary); color: var(--fg); }
.badge-outline { border: 1px solid var(--border); color: var(--muted); font-family: monospace; padding: 0.125rem 0.5rem; }
.badge-success { background: hsla(142,71%,45%,0.12); color: hsl(142,71%,32%); }

/* Avatar */
.avatar { width: 3.5rem; height: 3.5rem; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.875rem; background: var(--gradient-brand); color: white; flex-shrink: 0; overflow:hidden; }
.avatar img { width:100%; height:100%; object-fit:cover; }
.avatar-sm { width: 2rem; height: 2rem; font-size: 0.7rem; }
.avatar-lg { width: 2.25rem; height: 2.25rem; font-size: 0.75rem; border-radius: 0.5rem; }
.avatar-xl { width: 6rem; height: 6rem; font-size: 1.5rem; }

/* Hero card */
.hero-card { background: var(--gradient-hero); color: white; border: none; padding: 2rem; border-radius: var(--radius); position: relative; overflow: hidden; box-shadow: var(--shadow-brand); display:block; text-decoration:none; cursor:pointer; }
.hero-card:hover { text-decoration:none; transform: translateY(-2px); transition: transform 0.2s; }
.hero-card .orb { position: absolute; right: -2.5rem; bottom: -2.5rem; width: 12rem; height: 12rem; border-radius: 50%; background: rgba(255,255,255,0.1); filter: blur(40px); }
.hero-card .icon-box { position: absolute; right: 1.5rem; top: 1.5rem; width: 3.5rem; height: 3.5rem; border-radius: 1rem; background: rgba(255,255,255,0.15); display: flex; align-items: center; justify-content: center; font-size: 1.5rem; }
.hero-card .pill { display: inline-flex; align-items: center; gap: 0.5rem; margin-top: 1.25rem; background: rgba(255,255,255,0.15); border-radius: 999px; padding: 0.5rem 1rem; font-size: 0.875rem; font-weight: 600; color:white; }

/* Stat icon */
.stat-icon { width: 2.5rem; height: 2.5rem; border-radius: 0.75rem; display: flex; align-items: center; justify-content: center; font-size: 1.125rem; margin-bottom: 0.75rem; }
.stat-icon-primary { background: hsla(224,64%,33%,0.1); color: var(--primary); }
.stat-icon-accent { background: hsla(0,74%,50%,0.1); color: var(--accent); }
.stat-icon-brand { background: var(--gradient-brand); color: white; box-shadow: var(--shadow-brand); }

/* Photo upload zone */
.photo-zone { width: 100%; border: 2px dashed var(--border); border-radius: 0.75rem; padding: 2rem 1rem; display: flex; flex-direction: column; align-items: center; gap: 0.5rem; color: var(--muted); cursor: pointer; transition: all 0.2s; text-align:center; }
.photo-zone:hover { border-color: var(--primary); background: hsla(224,64%,33%,0.02); }
.photo-zone .cam-circle { width: 3rem; height: 3rem; border-radius: 50%; background: var(--gradient-brand); color: white; display: flex; align-items: center; justify-content: center; font-size: 1.25rem; box-shadow: var(--shadow-brand); }
.photo-zone img.preview { max-width:100%; max-height: 200px; border-radius: 0.5rem; object-fit: cover; }

/* Admin sidebar */
.admin-layout { display: flex; min-height: 100vh; }
.admin-sidebar { width: 240px; background: var(--sidebar-bg); color: var(--sidebar-fg); padding: 1rem 0; flex-shrink: 0; display:flex; flex-direction:column; position:sticky; top:0; height:100vh; }
.admin-sidebar .logo-area { padding: 0.75rem 1rem; border-bottom: 1px solid hsl(222,47%,18%); margin-bottom: 0.5rem; font-weight: 800; font-size: 1rem; color:white; }
.admin-sidebar .nav-item { display: flex; align-items: center; gap: 0.625rem; padding: 0.625rem 1rem; font-size: 0.875rem; color: hsla(220,14%,96%,0.7); cursor: pointer; transition: all 0.2s; text-decoration:none; }
.admin-sidebar .nav-item:hover, .admin-sidebar .nav-item.active { background: hsl(222,47%,16%); color: hsl(220,14%,96%); text-decoration:none; }
.admin-sidebar .footer { margin-top: auto; padding-top: 0.75rem; border-top: 1px solid hsl(222,47%,18%); font-size: 0.75rem; color: hsla(220,14%,96%,0.5); }
.admin-sidebar .footer .who { padding: 0.75rem 1rem; border-top:1px solid hsl(222,47%,18%); margin-top:0.5rem; color: hsla(220,14%,96%,0.7); font-weight:600; }
.admin-content { flex: 1; min-width: 0; }
.admin-header { height: 3.5rem; display: flex; align-items: center; border-bottom: 1px solid var(--border); padding: 0 1.5rem; background: hsla(0,0%,100%,0.6); position:sticky; top:0; z-index:30; backdrop-filter: blur(20px); }
.admin-body { padding: 1.75rem; }

/* Mobile menu toggle (admin) */
.menu-toggle { display:none; background:transparent; border:none; font-size: 1.25rem; cursor:pointer; }

/* Table-like */
.table-header { display: grid; grid-template-columns: 3fr 3fr 3fr 2fr 1fr; padding: 0.75rem 1rem; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 600; background: var(--secondary); border-bottom: 1px solid var(--border); gap:1rem; }
.table-row { display: grid; grid-template-columns: 3fr 3fr 3fr 2fr 1fr; padding: 0.75rem 1rem; align-items: center; border-bottom: 1px solid var(--border); font-size: 0.875rem; gap:1rem; }
.table-row:last-child { border-bottom:none; }
.table-row a { color: var(--fg); text-decoration:none; display:contents; }
.table-row.clickable { cursor:pointer; transition: background 0.15s; }
.table-row.clickable:hover { background: var(--secondary); }

/* Field details */
.field-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1rem; font-size: 0.875rem; }
.field-grid dt { font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); font-weight: 500; }
.field-grid dd { margin-top: 0.125rem; font-weight: 500; }

/* Phone prefix */
.phone-row { display: flex; }
.phone-prefix { display: inline-flex; align-items: center; padding: 0 0.75rem; border: 1px solid var(--border); border-right: none; border-radius: 0.5rem 0 0 0.5rem; background: var(--secondary); font-size: 0.875rem; font-weight: 500; color: var(--muted); height: 2.75rem; }
.phone-input { border-radius: 0 0.5rem 0.5rem 0 !important; }

/* OTP Input */
.otp-row { display:flex; gap: 0.5rem; }
.otp-box { width: 3rem; height: 3.5rem; text-align:center; font-size: 1.25rem; font-weight: 700; text-transform: uppercase; border:1px solid var(--border); border-radius: 0.5rem; background: white; outline:none; font-family: monospace; }
.otp-box:focus { border-color: var(--primary); box-shadow: 0 0 0 2px hsla(224,64%,33%,0.15); }

/* Reason / GPS box */
.reason-box { background: var(--secondary); border-radius: 0.75rem; padding: 1rem; }

/* Login background */
.login-bg { min-height: 100vh; background: radial-gradient(at 20% 0%, hsla(224,64%,33%,0.18) 0px, transparent 50%), radial-gradient(at 80% 0%, hsla(0,74%,50%,0.15) 0px, transparent 50%), radial-gradient(at 0% 100%, hsla(218,90%,56%,0.12) 0px, transparent 50%), radial-gradient(at 100% 100%, hsla(258,60%,40%,0.12) 0px, transparent 50%), var(--bg); display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 2rem 1rem; position: relative; overflow: hidden; }
.login-bg .orb1 { position: absolute; top: -10rem; right: -10rem; width: 24rem; height: 24rem; border-radius: 50%; background: var(--gradient-brand); opacity: 0.2; filter: blur(60px); pointer-events:none; }
.login-bg .orb2 { position: absolute; bottom: -10rem; left: -10rem; width: 24rem; height: 24rem; border-radius: 50%; background: linear-gradient(135deg, hsl(0,74%,50%), hsl(12,88%,58%)); opacity: 0.15; filter: blur(60px); pointer-events:none; }

/* Photo placeholder */
.img-placeholder { width: 100%; height: 18rem; background: var(--secondary); display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 0.875rem; overflow:hidden; }
.img-placeholder img { width:100%; height:100%; object-fit:cover; }

/* Search */
.search-wrap { position:relative; }
.search-wrap .icon { position:absolute; left:0.75rem; top:50%; transform:translateY(-50%); color:var(--muted); }
.search-wrap input { padding-left: 2.25rem; }

/* Profile card on home */
.profile-card { display:flex; align-items:center; gap:1rem; padding:1.25rem; background:var(--card); border:1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-card); }
.profile-photo { width:5rem; height:5rem; border-radius: 50%; background: var(--gradient-brand); color:white; display:flex; align-items:center; justify-content:center; font-size:1.5rem; font-weight: 800; overflow:hidden; flex-shrink:0; }
.profile-photo img { width:100%; height:100%; object-fit:cover; }

/* Utility classes */
.text-muted { color: var(--muted); }
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }
.text-4xl { font-size: 2.25rem; }
.font-bold { font-weight: 700; }
.font-semibold { font-weight: 600; }
.font-mono { font-family: monospace; }
.uppercase { text-transform: uppercase; }
.tracking-wide { letter-spacing: 0.05em; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.text-center { text-align: center; }
.text-right { text-align: right; }
.text-destructive { color: var(--destructive); }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-gradient-brand { background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; color: transparent; }

.brand-strip { height: 4px; background: var(--gradient-brand); }

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mt-5 { margin-top: 1.25rem; }
.mt-6 { margin-top: 1.5rem; }
.mt-8 { margin-top: 2rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mb-5 { margin-bottom: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.mb-8 { margin-bottom: 2rem; }
.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }
.p-3 { padding: 0.75rem; }
.p-4 { padding: 1rem; }
.p-5 { padding: 1.25rem; }
.p-6 { padding: 1.5rem; }
.p-7 { padding: 1.75rem; }
.p-8 { padding: 2rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.justify-between { justify-content: space-between; }
.justify-center { justify-content: center; }
.flex-1 { flex: 1; min-width:0; }
.flex-wrap { flex-wrap: wrap; }
.grid { display: grid; }
.grid-cols-2 { grid-template-columns: repeat(2, 1fr); }
.grid-cols-3 { grid-template-columns: repeat(3, 1fr); }
.grid-cols-4 { grid-template-columns: repeat(4, 1fr); }
.space-y-1 > * + * { margin-top: 0.25rem; }
.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }
.space-y-5 > * + * { margin-top: 1.25rem; }
.divide-y > * + * { border-top: 1px solid var(--border); }
.border-t { border-top: 1px solid var(--border); }
.border-b { border-bottom: 1px solid var(--border); }
.rounded { border-radius: 0.5rem; }
.rounded-xl { border-radius: 0.75rem; }
.rounded-full { border-radius: 9999px; }
.overflow-hidden { overflow: hidden; }
.w-full { width: 100%; }
.max-w-md { max-width: 28rem; margin-left: auto; margin-right: auto; }
.max-w-2xl { max-width: 42rem; margin-left: auto; margin-right: auto; }
.max-w-3xl { max-width: 48rem; margin-left: auto; margin-right: auto; }
.max-w-4xl { max-width: 56rem; margin-left: auto; margin-right: auto; }
.relative { position: relative; }
.inline-flex { display: inline-flex; align-items: center; }
.hidden { display:none; }

/* Mobile */
@media (max-width: 768px) {
  .admin-sidebar { position:fixed; left:-260px; top:0; bottom:0; height:100vh; transition: left 0.25s; z-index: 200; }
  .admin-sidebar.open { left:0; box-shadow: 0 0 40px rgba(0,0,0,0.3); }
  .menu-toggle { display: inline-flex; }
  .admin-body { padding: 1.25rem 1rem; }
  .grid-cols-2 { grid-template-columns: 1fr; }
  .grid-cols-3 { grid-template-columns: 1fr; }
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .table-header { display: none; }
  .table-row { grid-template-columns: 1fr; gap: 0.25rem; padding: 1rem; }
  .field-grid { grid-template-columns: 1fr; }
  .hide-mobile { display: none; }
}

/* Backdrop for mobile sidebar */
.sidebar-backdrop { display:none; position:fixed; inset:0; background: rgba(0,0,0,0.5); z-index: 150; }
.sidebar-backdrop.show { display:block; }
