/* ============================================================
   HRIS System — Global Stylesheet
   Matches the Tailwind design tokens and Shadcn component styles
   from the original React app as closely as possible.
   ============================================================ */

/* ─── CSS Variables (Design Tokens) ─────────────────────── */
:root {
  --background:      #ffffff;
  --foreground:      #0f172a;
  --card:            #ffffff;
  --card-foreground: #0f172a;
  --border:          #e2e8f0;
  --input:           #e2e8f0;
  --ring:            #3b82f6;
  --primary:         #1e40af;
  --primary-fg:      #ffffff;
  --secondary:       #f1f5f9;
  --secondary-fg:    #1e293b;
  --muted:           #f1f5f9;
  --muted-fg:        #64748b;
  --accent:          #f1f5f9;
  --accent-fg:       #0f172a;
  --destructive:     #ef4444;
  --destructive-fg:  #ffffff;
  --success:         #22c55e;
  --success-fg:      #166534;
  --warning:         #f59e0b;

  /* Sidebar tokens (matching src/index.css Tailwind config) */
  --sidebar-bg:          #1e293b;
  --sidebar-fg:          #f8fafc;
  --sidebar-border:      #334155;
  --sidebar-primary:     #60a5fa;
  --sidebar-accent:      #334155;
  --sidebar-accent-fg:   #f8fafc;

  --radius: 0.5rem;
  --font-sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

/* ─── Reset ──────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--font-sans);
  background: var(--background);
  color: var(--foreground);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; }

/* ─── App Layout (sidebar + main) ───────────────────────── */
.app-layout {
  display: flex;
  min-height: 100vh;
  
}

/* ─── Sidebar ────────────────────────────────────────────── */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: 256px;
  height: 100vh;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  z-index: 40;
  overflow: hidden;
}

.sidebar-header {
  padding: 1rem;
  border-bottom: 1px solid var(--sidebar-border);
  flex-shrink: 0;
}
.sidebar-logo {
  width: 100%;
  max-height: 64px;
  object-fit: contain;
  margin-bottom: 0.5rem;
}
.sidebar-title-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.25rem;
}
.sidebar-title-row .icon {
  width: 20px; height: 20px;
  color: var(--sidebar-primary);
  flex-shrink: 0;
}
.sidebar-title   { font-size: 0.875rem; font-weight: 700; color: var(--sidebar-fg); line-height: 1.2; }
.sidebar-subtitle{ font-size: 0.75rem; color: rgba(248,250,252,.7); }

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sidebar-nav::-webkit-scrollbar { width: 4px; }
.sidebar-nav::-webkit-scrollbar-track { background: transparent; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sidebar-border); border-radius: 2px; }

.nav-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: var(--radius);
  color: rgba(248,250,252,0.8);
  font-size: 0.875rem;
  transition: background 0.15s, color 0.15s;
  cursor: pointer;
}
.nav-link:hover,
.nav-link.active {
  background: var(--sidebar-accent);
  color: var(--sidebar-accent-fg);
}
.nav-link.active { font-weight: 500; }
.nav-icon { font-size: 0.9rem; width: 16px; text-align: center; flex-shrink: 0; }

.nav-section-label {
  padding: 0.625rem 0.75rem 0.25rem;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(248,250,252,0.5);
  margin-top: 0.25rem;
}

.sidebar-user {
  flex-shrink: 0;
  border-top: 1px solid var(--sidebar-border);
  padding: 0.75rem;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(51,65,85,.5);
  margin-bottom: 0.5rem;
}
.user-info .icon { width: 16px; height: 16px; color: var(--sidebar-fg); flex-shrink: 0; }
.user-email { font-size: 0.75rem; font-weight: 500; color: var(--sidebar-fg); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.user-role  { font-size: 0.65rem; color: rgba(248,250,252,.7); }

.btn-logout {
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  width: 100%;
  padding: 0.4rem 0.75rem;
  background: transparent;
  border: none;
  border-radius: var(--radius);
  color: rgba(248,250,252,.8);
  font-size: 0.75rem;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-logout:hover { background: var(--sidebar-accent); }
.icon-sm { width: 12px; height: 12px; }

/* ─── Main Content Area ──────────────────────────────────── */
.main-content {
  margin-left: 256px;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-header {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 1rem 2rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}
.main-header h2 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--foreground);
}
.header-right { display: flex; align-items: center; gap: 1rem; }
.bir-badge {
  display: flex; align-items: center; gap: 0.5rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius);
  background: rgba(34,197,94,.1);
  border: 1px solid rgba(34,197,94,.2);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--success-fg);
}
.bir-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  animation: pulse 2s infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }

.page-content { padding: 2rem; flex: 1; }

/* ─── Breadcrumb ─────────────────────────────────────────── */
.breadcrumb {
  display: flex; align-items: center; gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--muted-fg);
  margin-bottom: 1.5rem;
}
.breadcrumb a:hover { color: var(--foreground); }
.breadcrumb span { color: var(--muted-fg); }

/* ─── Card ───────────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) + 2px);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.card-header  { padding: 1.5rem 1.5rem 0; }
.card-content { padding: 1.5rem; }
.card-title   { font-size: 1rem; font-weight: 600; }
.card-desc    { font-size: 0.875rem; color: var(--muted-fg); margin-top: 0.25rem; }

/* Stat cards (dashboard) */
.stat-card { display: flex; flex-direction: column; gap: 0.25rem; }
.stat-value { font-size: 1.75rem; font-weight: 700; }
.stat-label { font-size: 0.8125rem; color: var(--muted-fg); }

/* ─── Grid utilities ─────────────────────────────────────── */
.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); }
.gap-4  { gap: 1rem; }
.gap-6  { gap: 1.5rem; }
.gap-8  { gap: 2rem; }

/* ─── Badge ──────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 0.125rem 0.625rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: nowrap;
}
.badge-default     { background: var(--primary);    color: var(--primary-fg); }
.badge-secondary   { background: var(--secondary);  color: var(--secondary-fg); }
.badge-success     { background: rgba(34,197,94,.15); color: #166534; }
.badge-destructive { background: rgba(239,68,68,.15); color: #991b1b; }
.badge-warning     { background: rgba(245,158,11,.15); color: #92400e; }
.badge-outline     { border: 1px solid var(--border); background: transparent; color: var(--foreground); }

/* ─── Table ──────────────────────────────────────────────── */
.table-wrap { width: 100%; overflow-x: auto; }
table  { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
thead  { border-bottom: 1px solid var(--border); }
th     { padding: 0.75rem 1rem; text-align: left; font-weight: 500; color: var(--muted-fg); white-space: nowrap; }
td     { padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: var(--muted); }

/* ─── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.375rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  white-space: nowrap;
  text-decoration: none;
}
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary    { background: var(--primary);  color: var(--primary-fg); border-color: var(--primary); }
.btn-primary:hover:not(:disabled)    { background: #1e3a8a; }
.btn-secondary  { background: var(--secondary); color: var(--secondary-fg); border-color: var(--border); }
.btn-secondary:hover:not(:disabled)  { background: #e2e8f0; }
.btn-outline    { background: transparent; border-color: var(--border); color: var(--foreground); }
.btn-outline:hover:not(:disabled)    { background: var(--accent); }
.btn-ghost      { background: transparent; border-color: transparent; color: var(--foreground); }
.btn-ghost:hover:not(:disabled)      { background: var(--accent); }
.btn-destructive{ background: var(--destructive); color: var(--destructive-fg); border-color: var(--destructive); }
.btn-sm         { padding: 0.375rem 0.75rem; font-size: 0.8125rem; }
.btn-lg         { padding: 0.75rem 1.5rem; font-size: 1rem; }
.btn-full       { width: 100%; }
.btn-icon       { padding: 0.5rem; }

/* ─── Forms ──────────────────────────────────────────────── */
.form-group { display: flex; flex-direction: column; gap: 0.375rem; }
label { font-size: 0.875rem; font-weight: 500; color: var(--foreground); }
.form-hint { font-size: 0.75rem; color: var(--muted-fg); }

.input, input[type="text"], input[type="email"], input[type="password"],
input[type="number"], input[type="tel"], input[type="date"], input[type="time"],
select, textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--input);
  border-radius: var(--radius);
  font-size: 0.875rem;
  background: var(--background);
  color: var(--foreground);
  transition: border-color 0.15s, box-shadow 0.15s;
  outline: none;
}
.input:focus, input:focus, select:focus, textarea:focus {
  border-color: var(--ring);
  box-shadow: 0 0 0 3px rgba(59,130,246,.15);
}
.input-error { border-color: var(--destructive); }
textarea { resize: vertical; min-height: 80px; }

/* Input with icon overlay */
.input-wrapper { position: relative; }
.input-icon-right { position: absolute; right: 0.625rem; top: 50%; transform: translateY(-50%); background: none; border: none; cursor: pointer; color: var(--muted-fg); }

/* ─── Tabs ───────────────────────────────────────────────── */
.tabs { width: 100%; }
.tabs-list {
  display: grid;
  border-radius: var(--radius);
  background: var(--muted);
  padding: 0.25rem;
  gap: 0.25rem;
}
.tabs-list.cols-2 { grid-template-columns: repeat(2, 1fr); }
.tabs-list.cols-3 { grid-template-columns: repeat(3, 1fr); }
.tabs-list.cols-4 { grid-template-columns: repeat(4, 1fr); }
.tab-trigger {
  padding: 0.5rem 1rem;
  border-radius: calc(var(--radius) - 2px);
  font-size: 0.875rem;
  font-weight: 500;
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--muted-fg);
  transition: background 0.15s, color 0.15s;
}
.tab-trigger.active,
.tab-trigger[aria-selected="true"] {
  background: var(--card);
  color: var(--foreground);
  box-shadow: 0 1px 3px rgba(0,0,0,.1);
}
.tab-content { display: none; padding-top: 1rem; }
.tab-content.active { display: block; }

/* ─── Dialog / Modal ─────────────────────────────────────── */
.dialog-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 50;
  display: flex; align-items: center; justify-content: center;
  padding: 1rem;
}
.dialog-overlay.hidden { display: none; }
.dialog {
  background: var(--card);
  border-radius: calc(var(--radius) + 4px);
  width: 100%;
  max-width: 520px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 1.5rem;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  position: relative;
}
.dialog-header { margin-bottom: 1rem; }
.dialog-title  { font-size: 1.125rem; font-weight: 600; }
.dialog-desc   { font-size: 0.875rem; color: var(--muted-fg); margin-top: 0.25rem; }
.dialog-close  {
  position: absolute; top: 1rem; right: 1rem;
  background: none; border: none; font-size: 1.25rem;
  cursor: pointer; color: var(--muted-fg);
  width: 2rem; height: 2rem;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
}
.dialog-close:hover { background: var(--accent); color: var(--foreground); }
.dialog-footer { display: flex; gap: 0.5rem; justify-content: flex-end; margin-top: 1.5rem; }

/* ─── Select ─────────────────────────────────────────────── */
select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2'%3E%3Cpolyline points='6,9 12,15 18,9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2.5rem;
}

/* ─── Alert / Notice ─────────────────────────────────────── */
.alert {
  padding: 0.875rem 1rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  display: flex; align-items: flex-start; gap: 0.5rem;
}
.alert-success  { background: rgba(34,197,94,.1);  border: 1px solid rgba(34,197,94,.2); color: #166534; }
.alert-error    { background: rgba(239,68,68,.1);  border: 1px solid rgba(239,68,68,.2);  color: #991b1b; }
.alert-warning  { background: rgba(245,158,11,.1); border: 1px solid rgba(245,158,11,.2); color: #92400e; }
.alert-info     { background: rgba(59,130,246,.1); border: 1px solid rgba(59,130,246,.2); color: #1e40af; }

/* ─── Toast Notifications ────────────────────────────────── */
#toast-container {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 0.5rem;
  pointer-events: none;
}
.toast {
  background: var(--foreground);
  color: var(--background);
  padding: 0.875rem 1.25rem;
  border-radius: var(--radius);
  font-size: 0.875rem;
  max-width: 380px;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
  display: flex; flex-direction: column; gap: 0.25rem;
  pointer-events: all;
  animation: slideIn 0.25s ease;
}
.toast-destructive { background: var(--destructive); }
.toast-title   { font-weight: 600; }
.toast-desc    { font-size: 0.8125rem; opacity: .85; }
@keyframes slideIn { from { transform: translateX(100%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ─── Utility Spacing ────────────────────────────────────── */
.mt-1{margin-top:.25rem}.mt-2{margin-top:.5rem}.mt-3{margin-top:.75rem}
.mt-4{margin-top:1rem}.mt-6{margin-top:1.5rem}.mt-8{margin-top:2rem}
.mb-1{margin-bottom:.25rem}.mb-2{margin-bottom:.5rem}.mb-4{margin-bottom:1rem}
.mb-6{margin-bottom:1.5rem}.mb-8{margin-bottom:2rem}
.p-4{padding:1rem}.p-6{padding:1.5rem}.p-8{padding:2rem}
.space-y-2 > * + * { margin-top:.5rem }
.space-y-4 > * + * { margin-top:1rem }
.space-y-6 > * + * { margin-top:1.5rem }
.flex{display:flex}.items-center{align-items:center}.justify-between{justify-content:space-between}
.justify-end{justify-content:flex-end}.gap-2{gap:.5rem}.gap-3{gap:.75rem}.gap-4{gap:1rem}
.flex-1{flex:1}.flex-wrap{flex-wrap:wrap}
.text-sm{font-size:.875rem}.text-xs{font-size:.75rem}.text-lg{font-size:1.125rem}
.text-xl{font-size:1.25rem}.text-2xl{font-size:1.5rem}.text-3xl{font-size:1.875rem}
.font-medium{font-weight:500}.font-semibold{font-weight:600}.font-bold{font-weight:700}
.text-muted{color:var(--muted-fg)}.text-destructive{color:var(--destructive)}
.text-success{color:var(--success)}.truncate{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.w-full{width:100%}.min-h-screen{min-height:100vh}
.rounded{border-radius:var(--radius)}.border{border:1px solid var(--border)}
.bg-muted{background:var(--muted)}.bg-card{background:var(--card)}
.hidden{display:none !important}

/* ─── Auth Page (login / register) ──────────────────────── */
.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 50%, #f8fafc 100%);
  padding: 1rem;
}
.auth-card {
  width: 100%;
  max-width: 448px;
}
.auth-card .card-header { padding: 2rem 2rem 0; text-align: center; }
.auth-card .card-content { padding: 1.5rem 2rem 2rem; }
.auth-logo { height: 80px; object-fit: contain; margin: 0 auto 1rem; }
.auth-title { font-size: 1.5rem; font-weight: 700; }
.auth-subtitle { color: var(--muted-fg); font-size: 0.875rem; margin-top: 0.25rem; }

/* ─── Spinner ────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 1rem; height: 1rem;
  border: 2px solid transparent;
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── Responsive ─────────────────────────────────────────── */
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); transition: transform 0.25s; }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }
  .grid-cols-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-cols-3 { grid-template-columns: repeat(2, 1fr); }
}


.page-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.col-time-att:first-child {
    width: 50%;   /* text area */
}

.col-time-att:last-child {
    width: 50%;   /* button area */
    text-align: right;
}



