/* ============================================================================
   VILARCI EMPLOYEE PORTAL — Pure CSS (no framework)
   No external imports → fully CSP-compliant under default-src 'none'
   ========================================================================== */

:root {
  /* Palette */
  --bg:           #f6f7fb;
  --surface:      #ffffff;
  --surface-2:    #f1f3f9;
  --border:       #e3e6ef;
  --border-2:     #d4d8e4;
  --text:         #0f172a;
  --text-muted:   #64748b;
  --text-faint:   #94a3b8;
  --brand:        #dc2626;  /* Vilarci red */
  --brand-dark:   #b91c1c;
  --brand-tint:   #fef2f2;
  --accent:       #4f46e5;
  --accent-dark:  #4338ca;
  --success:      #059669;
  --danger:       #dc2626;
  --warn:         #d97706;

  /* Spacing & radius */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;

  /* Shadows */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .04);
  --shadow-md: 0 4px 10px rgba(15, 23, 42, .06), 0 1px 3px rgba(15, 23, 42, .04);
  --shadow-lg: 0 12px 30px rgba(15, 23, 42, .10), 0 4px 12px rgba(15, 23, 42, .05);
}

/* ---------- Reset ---------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; }
input, button, select, textarea { font-family: inherit; font-size: 14px; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---------- LOGIN PAGE ---------- */
.login-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
  border-radius: var(--r-xl);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  padding: 40px 36px;
}
.login-card .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 28px;
}
.login-card .brand-dot {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand) 0%, #f97316 100%);
}
.login-card .brand-name {
  font-weight: 800;
  font-size: 17px;
  letter-spacing: -.01em;
}
.login-card h1 {
  font-size: 24px;
  font-weight: 800;
  letter-spacing: -.02em;
  margin-bottom: 6px;
}
.login-card .sub {
  color: var(--text-muted);
  font-size: 14px;
  margin-bottom: 28px;
}

/* ---------- Form ---------- */
.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
  margin-bottom: 6px;
}
.field input[type=text],
.field input[type=email],
.field input[type=password],
.field input[type=number],
.field input[type=url],
.field textarea {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-weight: 500;
  color: var(--text);
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.field textarea { resize: vertical; min-height: 80px; }
.field input:focus,
.field textarea:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79, 70, 229, .15);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: var(--r-md);
  font-weight: 700;
  font-size: 14px;
  transition: transform .05s, background .15s, box-shadow .15s, opacity .15s;
  user-select: none;
}
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary {
  background: var(--brand);
  color: #fff;
  box-shadow: 0 6px 14px rgba(220, 38, 38, .25);
}
.btn-primary:hover:not(:disabled) { background: var(--brand-dark); }
.btn-accent {
  background: var(--text);
  color: #fff;
}
.btn-accent:hover:not(:disabled) { background: #1e293b; }
.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 10px 14px;
}
.btn-ghost:hover:not(:disabled) { color: var(--text); background: var(--surface-2); }
.btn-danger {
  background: var(--danger);
  color: #fff;
}
.btn-danger:hover:not(:disabled) { background: var(--brand-dark); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: var(--r-sm); }

/* ---------- Status banner ---------- */
.banner {
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-weight: 600;
  font-size: 13px;
  margin-bottom: 16px;
  display: none;
}
.banner.show { display: block; }
.banner-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.banner-success { background: #ecfdf5; color: #065f46; border: 1px solid #a7f3d0; }
.banner-info    { background: #eef2ff; color: #3730a3; border: 1px solid #c7d2fe; }

/* ---------- TOTP code input ---------- */
.totp-grid {
  display: flex;
  gap: 8px;
  justify-content: center;
  margin: 20px 0 24px;
}
.totp-grid input {
  width: 46px;
  height: 56px;
  text-align: center;
  font-size: 22px;
  font-weight: 800;
  background: var(--surface-2);
  border: 2px solid var(--border);
  border-radius: var(--r-md);
  color: var(--text);
}
.totp-grid input:focus {
  outline: none;
  background: var(--surface);
  border-color: var(--accent);
}

.qr-wrap {
  display: flex;
  justify-content: center;
  margin: 18px 0;
}
.qr-wrap img {
  width: 200px;
  height: 200px;
  border-radius: var(--r-md);
  border: 1px solid var(--border);
  background: #fff;
  padding: 8px;
}
.secret-pill {
  display: block;
  text-align: center;
  font-family: ui-monospace, "SF Mono", Menlo, monospace;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 10px;
  font-size: 13px;
  letter-spacing: .04em;
  word-break: break-all;
  margin-bottom: 16px;
}

/* ---------- DASHBOARD ---------- */
.app-shell {
  display: grid;
  grid-template-rows: auto 1fr;
  height: 100vh;
}
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.topbar .left { display: flex; align-items: center; gap: 14px; }
.topbar .logo {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--brand) 0%, #f97316 100%);
}
.topbar .title { font-weight: 800; letter-spacing: -.01em; font-size: 15px; }
.topbar .right { display: flex; align-items: center; gap: 12px; }
.topbar .user-pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.main {
  padding: 24px;
  overflow: auto;
}
.tabs {
  display: inline-flex;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 4px;
  margin-bottom: 22px;
}
.tab {
  padding: 8px 18px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 13px;
  color: var(--text-muted);
}
.tab.active {
  background: var(--text);
  color: #fff;
}

.columns {
  display: grid;
  gap: 16px;
  align-items: start;
}
.columns.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.columns.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

@media (max-width: 980px) {
  .columns.cols-3, .columns.cols-2 { grid-template-columns: 1fr; }
}

.col {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  min-height: 460px;
  max-height: calc(100vh - 220px);
}
.col-head {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.col-head h3 {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .04em;
  color: var(--text-muted);
}
.col-body {
  padding: 8px;
  overflow-y: auto;
  flex: 1;
}
.col-body .empty {
  text-align: center;
  color: var(--text-faint);
  font-size: 13px;
  padding: 30px 16px;
}

.row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background .12s;
  border: 1px solid transparent;
}
.row-item:hover { background: var(--surface-2); }
.row-item.selected {
  background: var(--brand-tint);
  border-color: #fecaca;
}
.row-item .name {
  font-weight: 600;
  font-size: 13.5px;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-item .actions {
  display: none;
  gap: 4px;
}
.row-item:hover .actions,
.row-item.selected .actions { display: flex; }
.icon-btn {
  width: 28px; height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  color: var(--text-muted);
  font-size: 13px;
}
.icon-btn:hover { background: var(--surface); color: var(--text); }
.icon-btn.danger:hover { background: var(--brand-tint); color: var(--danger); }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(15, 23, 42, .55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal-backdrop.show { display: flex; }
.modal {
  background: var(--surface);
  border-radius: var(--r-xl);
  width: 100%;
  max-width: 440px;
  padding: 26px;
  box-shadow: var(--shadow-lg);
}
.modal h3 {
  font-size: 17px;
  font-weight: 800;
  letter-spacing: -.01em;
  margin-bottom: 6px;
}
.modal p.sub { color: var(--text-muted); font-size: 13px; margin-bottom: 18px; }
.modal .actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 8px;
}

/* ---------- Toast ---------- */
.toast-wrap {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 100;
  pointer-events: none;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: 10px 16px;
  border-radius: 999px;
  font-weight: 600;
  font-size: 13px;
  box-shadow: var(--shadow-lg);
  margin-bottom: 8px;
  opacity: 0;
  transform: translateY(-8px);
  transition: opacity .2s, transform .2s;
  pointer-events: auto;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #b91c1c; }
.toast.success { background: #047857; }

/* ---------- Loader ---------- */
.spinner {
  width: 16px; height: 16px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Utility ---------- */
.hidden { display: none !important; }
.muted { color: var(--text-muted); }
.row { display: flex; align-items: center; gap: 10px; }
.between { display: flex; align-items: center; justify-content: space-between; }
.mt-2 { margin-top: 8px; }
.mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; }
.mb-4 { margin-bottom: 16px; }
.full { width: 100%; }
.center { text-align: center; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.kbd {
  display: inline-block;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 1px 6px;
  font-family: ui-monospace, monospace;
  font-size: 12px;
}

/* Font-size utilities (CSP-safe replacements for inline style="font-size:") */
.fs-11 { font-size: 11.5px; }
.fs-12 { font-size: 12px; }
.fs-13 { font-size: 12.5px; }
