/* ── Cards ──────────────────────────────────────── */
.card {
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-md);
  background: var(--g-surface);
  padding: 20px;
  transition: border-color var(--g-duration) var(--g-ease);
}

.card:hover { border-color: var(--g-border-2); }

/* ── Buttons ───────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: var(--g-radius-sm);
  padding: 0 18px;
  font-weight: 600;
  font-size: .875rem;
  transition: background var(--g-duration) var(--g-ease),
              border-color var(--g-duration) var(--g-ease),
              transform 80ms var(--g-ease);
  cursor: pointer;
}

.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.btn-primary {
  background: var(--g-accent);
  color: #06131a;
}
.btn-primary:hover:not(:disabled) { background: var(--g-accent-2); }

.btn-secondary {
  background: var(--g-surface-2);
  border-color: var(--g-border);
  color: var(--g-text);
}
.btn-secondary:hover:not(:disabled) { background: var(--g-surface-3); border-color: var(--g-border-2); }

.btn-danger-subtle {
  background: rgba(239,100,97,.1);
  color: var(--g-danger);
  border-color: rgba(239,100,97,.2);
}
.btn-danger-subtle:hover:not(:disabled) { background: rgba(239,100,97,.18); }

.btn-success-subtle {
  background: rgba(69,185,124,.1);
  color: var(--g-success);
  border-color: rgba(69,185,124,.2);
}
.btn-success-subtle:hover:not(:disabled) { background: rgba(69,185,124,.18); }

.btn-sm { min-height: 32px; padding: 0 12px; font-size: .78rem; border-radius: var(--g-radius-xs); }
.btn-lg { min-height: 48px; padding: 0 28px; font-size: 1rem; border-radius: var(--g-radius-md); }
.btn-block { width: 100%; }

.btn-spinner {
  display: inline-block;
  width: 16px; height: 16px;
  border: 2px solid rgba(255,255,255,.3);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .6s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Form Fields ───────────────────────────────── */
.field { display: grid; gap: 6px; }
.field-label { font-size: .78rem; font-weight: 600; color: var(--g-muted); text-transform: uppercase; letter-spacing: .04em; }

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-sm);
  padding: 0 14px;
  background: var(--g-surface-2);
  color: var(--g-text);
  font-size: .9rem;
  transition: border-color var(--g-duration) var(--g-ease), box-shadow var(--g-duration) var(--g-ease);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--g-accent);
  box-shadow: 0 0 0 3px rgba(22,157,203,.15);
}

.field input::placeholder { color: var(--g-muted); opacity: .6; }

.input-select {
  min-height: 38px;
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-sm);
  padding: 0 12px;
  background: var(--g-surface-2);
  color: var(--g-text);
  font-size: .85rem;
  cursor: pointer;
}

.field-checkbox {
  flex-direction: row;
  align-items: center;
  gap: 8px;
}

.checkbox-group { display: flex; flex-wrap: wrap; gap: 12px; }
.checkbox-group input[type="checkbox"] { width: auto; min-height: auto; margin: 0; }
.checkbox-label { display: flex; align-items: center; gap: 6px; font-size: .85rem; cursor: pointer; }

/* ── Layout Helpers ────────────────────────────── */
.stack { display: grid; gap: 16px; }
.grid  { display: grid; gap: 16px; }

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 24px;
}

.page-title {
  margin: 0;
  font-size: clamp(1.5rem, 2.5vw, 2rem);
  font-weight: 800;
  line-height: 1.1;
  letter-spacing: -.02em;
}

.muted { color: var(--g-muted); }
.text-success { color: var(--g-success); }
.text-warning { color: var(--g-warning); }
.text-danger  { color: var(--g-danger); }

/* ── Status Badges ─────────────────────────────── */
.status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 10px;
  background: var(--g-surface-2);
  font-size: .75rem;
  font-weight: 600;
  letter-spacing: .02em;
  text-transform: capitalize;
}

.status-present, .status-active, .status-approved { background: rgba(69,185,124,.12); color: var(--g-success); }
.status-late, .status-paused, .status-changes_requested { background: rgba(240,160,60,.12); color: var(--g-warning); }
.status-absent, .status-rejected, .status-inactive { background: rgba(239,100,97,.12); color: var(--g-danger); }
.status-pending, .status-pending_approval { background: rgba(22,157,203,.12); color: var(--g-accent); }

/* ── Tables ────────────────────────────────────── */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-md);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 640px;
  background: var(--g-surface);
}

th, td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--g-border);
  text-align: left;
  font-size: .85rem;
}

th {
  color: var(--g-muted);
  font-size: .75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .04em;
  background: var(--g-surface);
  position: sticky;
  top: 0;
}

tbody tr { transition: background var(--g-duration) var(--g-ease); }
tbody tr:hover { background: var(--g-surface-2); }
tbody tr:last-child td { border-bottom: none; }

/* ── Empty State ───────────────────────────────── */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 200px;
  text-align: center;
}

.empty-state > * {
  margin: 0;
}

/* ── Loading ───────────────────────────────────── */
.loading-bar {
  height: 3px;
  background: var(--g-surface-2);
  border-radius: 99px;
  overflow: hidden;
  position: relative;
}

.loading-bar::after {
  content: '';
  position: absolute;
  top: 0; left: -30%;
  width: 30%; height: 100%;
  background: var(--g-accent);
  border-radius: 99px;
  animation: loading-slide 1.2s ease infinite;
}

@keyframes loading-slide {
  0% { left: -30%; }
  100% { left: 100%; }
}

/* ── Toast Notifications ───────────────────────── */
.toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  padding: 12px 20px;
  border-radius: var(--g-radius-sm);
  font-size: .85rem;
  font-weight: 500;
  box-shadow: var(--g-shadow);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity var(--g-duration) var(--g-ease), transform var(--g-duration) var(--g-ease);
  cursor: pointer;
  max-width: 380px;
}

.toast.is-visible { opacity: 1; transform: translateY(0); }
.toast-info    { background: var(--g-surface-2); color: var(--g-text); border: 1px solid var(--g-border); }
.toast-success { background: rgba(69,185,124,.15); color: var(--g-success); border: 1px solid rgba(69,185,124,.3); }
.toast-error   { background: rgba(239,100,97,.15); color: var(--g-danger); border: 1px solid rgba(239,100,97,.3); }
.toast-warning { background: rgba(240,160,60,.15); color: var(--g-warning); border: 1px solid rgba(240,160,60,.3); }

/* ── Modal ─────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0,0,0,.65);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity var(--g-duration) var(--g-ease);
}

.modal-backdrop.is-visible { opacity: 1; }

.modal {
  width: min(100%, 480px);
  max-height: 80vh;
  overflow-y: auto;
  background: var(--g-surface);
  border: 1px solid var(--g-border);
  border-radius: var(--g-radius-lg);
  box-shadow: var(--g-shadow-lg);
  transform: scale(.95);
  transition: transform var(--g-duration) var(--g-ease);
}

.modal-backdrop.is-visible .modal { transform: scale(1); }

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 0;
}

.modal-title { margin: 0; font-size: 1.1rem; font-weight: 700; }
.modal-close { font-size: 1.5rem; color: var(--g-muted); width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: var(--g-radius-xs); }
.modal-close:hover { background: var(--g-surface-2); color: var(--g-text); }

.modal-body { padding: 20px 24px; }

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  padding: 16px 24px;
  border-top: 1px solid var(--g-border);
}

/* ── Charts ────────────────────────────────────── */
.ring-chart { width: 100%; max-width: 120px; }

.ring-chart-value {
  transition: stroke-dashoffset 1s var(--g-ease);
}

/* animate on load */
.ring-chart-value { stroke-dashoffset: var(--target-offset, 0); }

.bar-chart { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 100px 1fr 40px; align-items: center; gap: 10px; animation: bar-enter 300ms var(--g-ease) var(--delay, 0ms) both; }
.bar-label { font-size: .78rem; color: var(--g-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 8px; background: var(--g-surface-2); border-radius: 99px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 99px; transition: width .6s var(--g-ease); }
.bar-value { font-size: .78rem; font-weight: 700; text-align: right; }

@keyframes bar-enter { from { opacity: 0; transform: translateX(-8px); } to { opacity: 1; transform: none; } }

.mini-bars { display: flex; align-items: flex-end; gap: 3px; height: 48px; }
.mini-bar-col { display: flex; flex-direction: column; align-items: center; flex: 1; height: 100%; justify-content: flex-end; }
.mini-bar { width: 100%; min-width: 6px; border-radius: 3px 3px 0 0; transition: height .5s var(--g-ease); }
.mini-bar-label { font-size: .6rem; color: var(--g-muted); margin-top: 2px; }

/* ── Role Badges ───────────────────────────────── */
.person-role-badge {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .02em;
}

.role-super_admin      { background: rgba(22,157,203,.15); color: var(--g-accent); }
.role-account_manager  { background: rgba(240,160,60,.12); color: var(--g-warning); }
.role-employee         { background: var(--g-surface-3); color: var(--g-muted); }

/* ── Error Screen ──────────────────────────────── */
.error-screen {
  min-height: 100vh; min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 24px;
}
