/* ─── TECHSIROCCO — Design System ────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700;0,9..40,800;1,9..40,400&display=swap');

:root {
  --sand:       #f5f0e8;
  --sand-dark:  #ece5d8;
  --amber:      #c8860a;
  --amber-dark: #a86e08;
  --amber-light:#fef3d8;
  --ink:        #1a1610;
  --ink-light:  #4a4035;
  --muted:      #8a7d6e;
  --white:      #ffffff;
  --border:     #e2d9cc;
  --radius:     10px;
  --radius-lg:  16px;
  --shadow:     0 1px 4px rgba(26,22,16,.06), 0 4px 16px rgba(26,22,16,.06);
  --shadow-lg:  0 4px 12px rgba(26,22,16,.10), 0 16px 40px rgba(26,22,16,.08);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: 'DM Sans', system-ui, sans-serif;
  background: var(--sand);
  color: var(--ink);
  line-height: 1.6;
  font-size: 15px;
  min-height: 100vh;
}

/* ─── Typography ─────────────────────────────────────────────────────────── */

h1 { font-size: 1.75rem; font-weight: 700; letter-spacing: -0.02em; }
h2 { font-size: 1.35rem; font-weight: 700; letter-spacing: -0.01em; }
h3 { font-size: 1.1rem;  font-weight: 600; }

.brand {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--amber);
  letter-spacing: -0.03em;
}
.brand span { color: var(--ink); font-weight: 300; }

/* ─── Layout ─────────────────────────────────────────────────────────────── */

.app-layout {
  display: flex;
  min-height: 100vh;
}

/* ─── Sidebar ────────────────────────────────────────────────────────────── */

.sidebar {
  width: 240px;
  min-height: 100vh;
  background: var(--ink);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 100;
  transition: transform .25s ease;
}

.sidebar-logo {
  padding: 28px 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

.sidebar-logo .brand { color: var(--amber); }
.sidebar-logo .brand span { color: rgba(255,255,255,.6); }

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: rgba(255,255,255,.6);
  text-decoration: none;
  font-weight: 500;
  font-size: 14px;
  transition: all .15s;
}

.nav-link:hover {
  background: rgba(255,255,255,.07);
  color: #fff;
}

.nav-link.active {
  background: var(--amber);
  color: #fff;
}

.nav-link svg { width: 18px; height: 18px; flex-shrink: 0; }

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,.08);
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 8px;
}

.user-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--amber);
  color: #fff;
  font-weight: 700;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.user-info { overflow: hidden; }
.user-name { font-size: 13px; font-weight: 600; color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-plan { font-size: 11px; color: var(--amber); text-transform: capitalize; font-weight: 500; }

.btn-logout {
  width: 100%;
  margin-top: 8px;
  padding: 8px 12px;
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 8px;
  background: transparent;
  color: rgba(255,255,255,.5);
  font-size: 13px;
  cursor: pointer;
  transition: all .15s;
  text-align: left;
}

.btn-logout:hover {
  background: rgba(255,59,48,.15);
  color: #ff6b6b;
  border-color: rgba(255,59,48,.3);
}

/* ─── Main content ───────────────────────────────────────────────────────── */

.main-content {
  margin-left: 240px;
  flex: 1;
  padding: 32px;
  max-width: 1100px;
}

.page-header {
  margin-bottom: 28px;
}

.page-header h1 { margin-bottom: 4px; }
.page-subtitle { color: var(--muted); font-size: 14px; }

/* ─── Cards ──────────────────────────────────────────────────────────────── */

.card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

.card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ─── Stat cards ─────────────────────────────────────────────────────────── */

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 28px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 20px 24px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 8px;
}

.stat-value {
  font-size: 2rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 4px;
}

.stat-sub {
  font-size: 13px;
  color: var(--muted);
}

.stat-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
}

.stat-icon.amber { background: var(--amber-light); color: var(--amber); }
.stat-icon.green { background: #e8f5e9; color: #2e7d32; }
.stat-icon.blue  { background: #e3f2fd; color: #1565c0; }
.stat-icon.red   { background: #fce4ec; color: #c62828; }

/* ─── Progress bar ───────────────────────────────────────────────────────── */

.progress-wrap { margin-top: 12px; }

.progress-bar-bg {
  height: 8px;
  background: var(--sand);
  border-radius: 99px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--amber);
  transition: width .4s ease;
}

.progress-bar-fill.warning { background: #f59e0b; }
.progress-bar-fill.danger  { background: #ef4444; }

.progress-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
  margin-top: 6px;
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 18px;
  border-radius: 8px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
  border: none;
  transition: all .15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--amber);
  color: #fff;
}

.btn-primary:hover { background: var(--amber-dark); transform: translateY(-1px); }

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--border);
  color: var(--ink);
}

.btn-outline:hover { border-color: var(--amber); color: var(--amber); }

.btn-ghost {
  background: transparent;
  color: var(--muted);
  padding: 8px 12px;
}

.btn-ghost:hover { background: var(--sand); color: var(--ink); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-danger:hover { background: #dc2626; }

.btn:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

/* ─── Forms ──────────────────────────────────────────────────────────────── */

.form-group { margin-bottom: 18px; }

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-light);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  background: var(--white);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--amber);
  box-shadow: 0 0 0 3px rgba(200, 134, 10, .12);
}

textarea { resize: vertical; min-height: 100px; }

.form-error {
  color: #ef4444;
  font-size: 13px;
  margin-top: 6px;
}

/* ─── Tables ─────────────────────────────────────────────────────────────── */

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

thead th {
  text-align: left;
  padding: 10px 16px;
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid var(--border);
  background: var(--sand);
}

tbody td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--ink);
}

tbody tr:last-child td { border-bottom: none; }

tbody tr:hover { background: var(--sand); }

.cell-muted { color: var(--muted); }

/* ─── Badges ─────────────────────────────────────────────────────────────── */

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 99px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.badge-success { background: #e8f5e9; color: #2e7d32; }
.badge-warning { background: #fff8e1; color: #e65100; }
.badge-danger  { background: #fce4ec; color: #c62828; }
.badge-info    { background: #e3f2fd; color: #1565c0; }
.badge-neutral { background: var(--sand-dark); color: var(--muted); }

/* ─── Modal ──────────────────────────────────────────────────────────────── */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(26,22,16,.5);
  z-index: 999;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.modal-overlay.open { display: flex; }

.modal {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 32px;
  width: 100%;
  max-width: 520px;
  box-shadow: var(--shadow-lg);
  animation: slideUp .2s ease;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
}

.modal-close {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--muted);
  font-size: 20px;
  line-height: 1;
  padding: 4px;
}

.modal-close:hover { color: var(--ink); }

@keyframes slideUp {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ─── Login page ─────────────────────────────────────────────────────────── */

.auth-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--sand);
  padding: 24px;
}

.auth-card {
  background: var(--white);
  border-radius: var(--radius-lg);
  padding: 44px 40px;
  width: 100%;
  max-width: 420px;
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
}

.auth-logo {
  text-align: center;
  margin-bottom: 8px;
}

.auth-logo .brand { font-size: 1.5rem; }

.auth-tagline {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 36px;
}

.auth-title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 24px;
  color: var(--ink);
}

.auth-link {
  color: var(--amber);
  text-decoration: none;
  font-weight: 600;
  font-size: 14px;
}

.auth-link:hover { text-decoration: underline; }

.auth-footer {
  text-align: center;
  margin-top: 20px;
  color: var(--muted);
  font-size: 14px;
}

/* ─── Alert ──────────────────────────────────────────────────────────────── */

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  margin-bottom: 18px;
  display: none;
}

.alert.show { display: block; }
.alert-error { background: #fce4ec; color: #c62828; border: 1px solid #f8bbd0; }
.alert-success { background: #e8f5e9; color: #2e7d32; border: 1px solid #c8e6c9; }

/* ─── Toast ──────────────────────────────────────────────────────────────── */

.toast {
  position: fixed;
  bottom: 28px;
  right: 28px;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 9999;
  opacity: 0;
  transform: translateY(10px);
  transition: all .25s ease;
  max-width: 360px;
}

.toast-visible { opacity: 1; transform: translateY(0); }
.toast-success { background: #1a1610; color: #fff; }
.toast-error   { background: #c62828; color: #fff; }

/* ─── Empty state ────────────────────────────────────────────────────────── */

.empty-state {
  text-align: center;
  padding: 56px 24px;
  color: var(--muted);
}

.empty-state svg { margin-bottom: 16px; opacity: .4; }
.empty-state p { font-size: 15px; }

/* ─── Ticket thread ──────────────────────────────────────────────────────── */

.message-bubble {
  margin-bottom: 16px;
}

.message-bubble.mine {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.bubble-content {
  max-width: 70%;
  padding: 12px 16px;
  border-radius: 12px;
  font-size: 14px;
  line-height: 1.5;
}

.message-bubble:not(.mine) .bubble-content {
  background: var(--sand);
  border-bottom-left-radius: 4px;
}

.message-bubble.mine .bubble-content {
  background: var(--amber);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.bubble-meta {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.message-bubble.mine .bubble-meta { text-align: right; }

/* ─── Plan badge ─────────────────────────────────────────────────────────── */

.plan-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  background: var(--amber-light);
  color: var(--amber-dark);
  border-radius: 99px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ─── Mobile ─────────────────────────────────────────────────────────────── */

.menu-toggle {
  display: none;
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 200;
  background: var(--ink);
  border: none;
  border-radius: 8px;
  padding: 8px;
  cursor: pointer;
}

.menu-toggle svg { display: block; color: #fff; }

@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; padding: 20px 16px; }
  .menu-toggle { display: flex; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .auth-card { padding: 32px 24px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .modal { padding: 24px; }
}
