/* TrueTalent Invoice Portal — Design System */
:root {
  --bg: #f4f4f4;
  --surface: rgba(255,255,255,0.86);
  --surface-solid: #ffffff;
  --surface-2: #fafafa;
  --text: #111111;
  --text-muted: #5f5f5f;
  --text-faint: #8a8a8a;
  --border: rgba(0,0,0,0.10);
  --border-strong: rgba(0,0,0,0.16);
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.06);
  --shadow-md: 0 10px 30px rgba(0,0,0,0.08);
  --shadow-lg: 0 18px 60px rgba(0,0,0,0.10);
  --radius-sm: 10px;
  --radius-md: 14px;
  --radius-lg: 18px;
  --radius-xl: 24px;
  --focus-ring: 0 0 0 4px rgba(0,0,0,0.12);
}

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

body {
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background:
    radial-gradient(1200px 800px at 15% -10%, rgba(0,0,0,0.055), transparent 55%),
    radial-gradient(1000px 700px at 95% 0%, rgba(0,0,0,0.04), transparent 55%),
    linear-gradient(180deg,#f7f7f7,#f3f3f3);
  color: var(--text);
  line-height: 1.55;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ——— Cards ——— */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 28px;
}

/* ——— Buttons ——— */
.btn {
  border-radius: 999px;
  padding: 10px 20px;
  font-weight: 650;
  letter-spacing: 0.01em;
  border: none;
  cursor: pointer;
  font-size: 14px;
  font-family: inherit;
  transition: all 0.2s ease;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn-primary { background: #111; color: #fff; }
.btn-primary:hover { background: #222; transform: translateY(-1px); box-shadow: 0 4px 12px rgba(0,0,0,0.15); }
.btn-secondary { background: rgba(255,255,255,0.72); color: var(--text); border: 1px solid var(--border-strong); }
.btn-secondary:hover { background: rgba(255,255,255,0.92); transform: translateY(-1px); }
.btn-danger { background: #dc3545; color: #fff; }
.btn-danger:hover { background: #c82333; transform: translateY(-1px); }
.btn-sm { padding: 6px 14px; font-size: 12px; }
.btn-lg { padding: 13px 28px; font-size: 16px; }
.btn-block { width: 100%; justify-content: center; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none !important; }

/* ——— Inputs ——— */
input, select, textarea {
  width: 100%;
  background: rgba(255,255,255,0.92);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 11px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s;
  appearance: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: rgba(0,0,0,0.35);
  box-shadow: var(--focus-ring);
}
textarea { resize: vertical; min-height: 80px; }
select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%235f5f5f' d='M1 1l5 5 5-5'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; padding-right: 36px; }
input[type="number"] { -moz-appearance: textfield; }
input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

.form-group { margin-bottom: 18px; }
.form-group label { display: block; margin-bottom: 7px; font-weight: 600; color: var(--text-muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.03em; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-row.cols-3 { grid-template-columns: 1fr 1fr 1fr; }

/* ——— Login ——— */
.login-container { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { max-width: 440px; width: 100%; }
.logo-wrap { text-align: center; margin-bottom: 28px; }
.portal-logo { max-width: 260px; width: 100%; height: auto; }
.login-card h1 { text-align: center; font-size: 26px; color: var(--text); margin-bottom: 6px; letter-spacing: -0.02em; }
.login-subtitle { text-align: center; color: var(--text-muted); margin-bottom: 28px; font-size: 14px; }
.login-footer { text-align: center; padding-top: 18px; border-top: 1px solid var(--border); margin-top: 20px; }

/* ——— Dashboard ——— */
.dashboard-wrap { max-width: 1280px; margin: 0 auto; padding: 20px; }
.topbar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 18px 28px;
  margin-bottom: 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-logo { height: 32px; width: auto; }
.topbar-title h1 { font-size: 20px; font-weight: 700; color: var(--text); letter-spacing: -0.02em; }
.topbar-title p { font-size: 13px; color: var(--text-muted); }
.topbar-right { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.user-chip { background: rgba(0,0,0,0.05); border: 1px solid var(--border); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; color: var(--text-muted); }

/* ——— Section headers ——— */
.section-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.section-head h2 { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }
.section-head p { color: var(--text-muted); font-size: 14px; margin-top: 4px; }

/* ——— Generator cards ——— */
.gen-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 18px; }
.gen-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  display: block;
  transition: all 0.2s ease;
  cursor: pointer;
}
.gen-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--border-strong); }
.gen-card-icon { font-size: 28px; margin-bottom: 12px; }
.gen-card h3 { font-size: 17px; font-weight: 700; margin-bottom: 6px; }
.gen-card p { color: var(--text-muted); font-size: 13px; line-height: 1.5; margin-bottom: 14px; }
.gen-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; }
.gen-badge.standard { background: rgba(0,0,0,0.06); color: var(--text); border: 1px solid var(--border); }
.gen-badge.recommended { background: #111; color: #fff; }
.gen-badge.admin-only { background: #2d2d2d; color: #fff; }

/* ——— Folder/Invoice tree ——— */
.folder-tree { display: flex; flex-direction: column; gap: 14px; }
.folder-item { border: 1px solid var(--border); border-radius: var(--radius-md); overflow: hidden; background: var(--surface); }
.folder-head {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 18px; cursor: pointer;
  background: rgba(0,0,0,0.025);
  border-bottom: 1px solid var(--border);
  user-select: none;
  transition: background 0.15s;
}
.folder-head:hover { background: rgba(0,0,0,0.04); }
.folder-head .folder-icon { font-size: 18px; }
.folder-head .folder-name { font-weight: 700; font-size: 15px; flex: 1; }
.folder-head .folder-count { font-size: 12px; color: var(--text-muted); background: rgba(0,0,0,0.06); border-radius: 999px; padding: 2px 10px; }
.folder-head .folder-toggle { font-size: 12px; color: var(--text-faint); transition: transform 0.2s; }
.folder-head.open .folder-toggle { transform: rotate(90deg); }
.folder-content { display: none; }
.folder-content.open { display: block; }
.subfolder-item { border-top: 1px solid var(--border); }
.subfolder-head {
  display: flex; align-items: center; gap: 8px;
  padding: 11px 18px 11px 36px;
  cursor: pointer; background: rgba(0,0,0,0.01);
  user-select: none; transition: background 0.15s;
}
.subfolder-head:hover { background: rgba(0,0,0,0.03); }
.subfolder-head .subfolder-name { font-weight: 600; font-size: 14px; flex: 1; }
.subfolder-head .subfolder-count { font-size: 12px; color: var(--text-muted); background: rgba(0,0,0,0.05); border-radius: 999px; padding: 2px 9px; }
.subfolder-content { display: none; }
.subfolder-content.open { display: block; }

/* ——— Table ——— */
.table-wrap { border-radius: var(--radius-md); border: 1px solid var(--border); overflow: hidden; background: rgba(255,255,255,0.78); }
table { width: 100%; border-collapse: collapse; }
thead { background: rgba(0,0,0,0.03); }
th { padding: 11px 16px; text-align: left; font-size: 11px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.6px; border-bottom: 1px solid var(--border); }
td { padding: 13px 16px; font-size: 13px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover { background: rgba(0,0,0,0.015); }
.td-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ——— Badges ——— */
.badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px; border: 1px solid transparent; }
.badge-draft { background: rgba(108,117,125,0.12); border-color: rgba(108,117,125,0.3); color: #555; }
.badge-final { background: rgba(25,135,84,0.10); border-color: rgba(25,135,84,0.3); color: #198754; }
.badge-splitpay { background: rgba(13,110,253,0.09); border-color: rgba(13,110,253,0.25); color: #0d6efd; }
.badge-standard { background: rgba(0,0,0,0.06); border-color: var(--border); color: var(--text-muted); }
.badge-management { background: rgba(102,16,242,0.09); border-color: rgba(102,16,242,0.25); color: #6610f2; }

/* ——— Stats row ——— */
.stats-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 28px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 20px 22px; box-shadow: var(--shadow-sm); }
.stat-card .stat-label { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin-bottom: 6px; }
.stat-card .stat-value { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; color: var(--text); }
.stat-card .stat-sub { font-size: 12px; color: var(--text-faint); margin-top: 3px; }

/* ——— Alerts ——— */
.alert { border-radius: var(--radius-md); padding: 12px 16px; font-size: 14px; margin-bottom: 16px; display: none; }
.alert.show { display: block; }
.alert-error { background: rgba(220,53,69,0.09); border: 1px solid rgba(220,53,69,0.28); color: #721c24; }
.alert-success { background: rgba(25,135,84,0.09); border: 1px solid rgba(25,135,84,0.28); color: #155724; }
.alert-info { background: rgba(13,110,253,0.07); border: 1px solid rgba(13,110,253,0.22); color: #084298; }

/* ——— Modal ——— */
.modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.35); backdrop-filter: blur(6px); display: flex; align-items: center; justify-content: center; z-index: 9000; padding: 20px; }
.modal { background: var(--surface-solid); border: 1px solid var(--border); box-shadow: var(--shadow-lg); border-radius: var(--radius-xl); max-width: 520px; width: 100%; max-height: 90vh; overflow-y: auto; padding: 32px; }
.modal h2 { font-size: 22px; font-weight: 700; margin-bottom: 6px; }
.modal p.modal-sub { color: var(--text-muted); font-size: 14px; margin-bottom: 24px; }
.modal-footer { display: flex; gap: 10px; justify-content: flex-end; margin-top: 24px; }

/* ——— Generator layout ——— */
.generator-page { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; max-width: 1400px; margin: 0 auto; padding: 20px; min-height: 100vh; align-items: start; }
@media (max-width: 900px) { .generator-page { grid-template-columns: 1fr; } }
.gen-form-panel { position: sticky; top: 20px; max-height: calc(100vh - 40px); overflow-y: auto; }
.gen-preview-panel { min-height: 600px; }

/* ——— Invoice preview (A4) ——— */
.invoice-preview-wrap { background: rgba(0,0,0,0.06); border-radius: var(--radius-lg); padding: 20px; }
.invoice-paper {
  background: #fff;
  width: 100%;
  aspect-ratio: 210/297;
  border-radius: 4px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  padding: 40px;
  font-family: ui-sans-serif, system-ui, -apple-system, sans-serif;
  font-size: 12px;
  color: #111;
  overflow: hidden;
  position: relative;
}
.inv-header { display: flex; justify-content: space-between; margin-bottom: 30px; }
.inv-from { flex: 1; }
.inv-from h2 { font-size: 16px; font-weight: 800; margin-bottom: 4px; }
.inv-from p { font-size: 11px; color: #555; line-height: 1.6; }
.inv-logo { text-align: right; }
.inv-logo img { height: 36px; width: auto; }
.inv-title-block { margin-bottom: 24px; border-bottom: 2px solid #111; padding-bottom: 14px; }
.inv-title-block h1 { font-size: 20px; font-weight: 800; letter-spacing: -0.02em; }
.inv-title-block .inv-meta { display: flex; gap: 24px; margin-top: 6px; font-size: 11px; color: #555; }
.inv-to { margin-bottom: 22px; }
.inv-to h4 { font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; color: #888; margin-bottom: 5px; }
.inv-to p { font-size: 12px; line-height: 1.6; }
.inv-table { width: 100%; border-collapse: collapse; margin-bottom: 18px; }
.inv-table th { font-size: 9px; text-transform: uppercase; letter-spacing: 0.5px; color: #888; padding: 5px 0; border-bottom: 1px solid #e0e0e0; text-align: left; }
.inv-table th:last-child, .inv-table td:last-child { text-align: right; }
.inv-table td { padding: 6px 0; font-size: 11px; border-bottom: 1px solid #f0f0f0; }
.inv-totals { margin-left: auto; width: 200px; }
.inv-total-row { display: flex; justify-content: space-between; padding: 3px 0; font-size: 11px; }
.inv-total-row.grand { border-top: 2px solid #111; margin-top: 6px; padding-top: 6px; font-weight: 800; font-size: 13px; }
.inv-footer { position: absolute; bottom: 30px; left: 40px; right: 40px; font-size: 9px; color: #aaa; text-align: center; border-top: 1px solid #f0f0f0; padding-top: 8px; }

/* ——— Split indicator ——— */
.split-bands { display: flex; border-radius: 6px; overflow: hidden; margin: 14px 0; height: 8px; }
.split-talent { background: #111; flex: 1; }
.split-management { background: #aaa; width: 30%; }

/* ——— Empty state ——— */
.empty-state { text-align: center; padding: 60px 20px; color: var(--text-muted); }
.empty-state .empty-icon { font-size: 40px; margin-bottom: 14px; }
.empty-state h3 { font-size: 17px; font-weight: 700; margin-bottom: 6px; color: var(--text); }
.empty-state p { font-size: 14px; }

/* ——— Toast ——— */
.toast-container { position: fixed; bottom: 24px; right: 24px; display: flex; flex-direction: column; gap: 10px; z-index: 9999; }
.toast { background: var(--surface-solid); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 14px 18px; font-size: 14px; font-weight: 600; min-width: 240px; animation: slideIn 0.25s ease; }
.toast.toast-success { border-left: 4px solid #198754; }
.toast.toast-error { border-left: 4px solid #dc3545; }
.toast.toast-info { border-left: 4px solid #0d6efd; }
@keyframes slideIn { from { transform: translateX(50px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ——— Search/filter bar ——— */
.filter-bar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; }
.filter-bar input, .filter-bar select { flex: 1; min-width: 140px; max-width: 280px; }

/* ——— Tabs ——— */
.tabs { display: flex; gap: 4px; background: rgba(0,0,0,0.05); border-radius: 999px; padding: 4px; margin-bottom: 24px; }
.tab-btn { border: none; background: none; border-radius: 999px; padding: 8px 18px; font-size: 13px; font-weight: 600; color: var(--text-muted); cursor: pointer; transition: all 0.2s; }
.tab-btn.active { background: #fff; color: var(--text); box-shadow: var(--shadow-sm); }

/* ——— Print for PDF ——— */
@media print {
  body * { visibility: hidden; }
  #print-area, #print-area * { visibility: visible; }
  #print-area { position: fixed; inset: 0; background: white; padding: 0; }
}

/* ——— Responsive ——— */
@media (max-width: 768px) {
  .gen-grid { grid-template-columns: 1fr; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .form-row, .form-row.cols-3 { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: 1fr 1fr; }
  .modal { padding: 20px; }
  .filter-bar { flex-direction: column; }
  .filter-bar input, .filter-bar select { max-width: none; }
}
@media (max-width: 480px) {
  .stats-row { grid-template-columns: 1fr; }
  .dashboard-wrap { padding: 12px; }
}
