@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  --navy-950: #0b1526;
  --navy-900: #0f1c33;
  --navy-800: #16274a;
  --navy-700: #1e335c;
  --ink: #16202f;
  --ink-soft: #47566b;
  --muted: #7c8aa0;
  --line: #e3e8ef;
  --bg: #f5f7fa;
  --panel: #ffffff;
  --amber: #f2a71b;
  --amber-dark: #c8850e;
  --blue: #2f5fd6;
  --green: #1f9d55;
  --red: #d8483a;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 28, 51, 0.06), 0 1px 1px rgba(15, 28, 51, 0.04);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 14.5px;
  line-height: 1.5;
}

code, .mono, .ticket-code {
  font-family: 'JetBrains Mono', ui-monospace, monospace;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

h1, h2, h3 { font-weight: 700; letter-spacing: -0.01em; margin: 0 0 .4em; }

/* ---------- Layout ---------- */
.app-shell { display: flex; min-height: 100vh; }

.sidebar {
  width: 234px;
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--navy-950), var(--navy-900));
  color: #cdd8ec;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand {
  padding: 20px 18px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.brand .lamp {
  width: 11px; height: 11px; border-radius: 50%;
  background: var(--amber);
  box-shadow: 0 0 10px 2px rgba(242,167,27,0.6);
  flex-shrink: 0;
}
.brand-logo {
  width: 48px; height: 48px; object-fit: contain; border-radius: 7px;
  background: #fff; padding: 3px; flex-shrink: 0;
}
.brand-copy { min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.brand-name { font-weight: 800; font-size: 13px; line-height: 1.2; color: #fff; letter-spacing: -0.01em; }
.brand-tagline { font-size: 10.5px; color: #91a1bc; }

.nav { padding: 14px 10px; flex: 1; overflow-y: auto; }
.nav-section { margin-bottom: 18px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6f80a0; padding: 0 10px 6px; }
.nav a {
  display: flex; align-items: center; gap: 9px;
  padding: 8px 10px; border-radius: 8px; color: #b7c4dc;
  font-size: 13.6px; font-weight: 500; margin-bottom: 1px;
}
.nav a:hover { background: rgba(255,255,255,0.06); text-decoration: none; color: #fff; }
.nav a.active { background: var(--navy-700); color: #fff; }
.nav svg { width: 16px; height: 16px; opacity: .85; flex-shrink: 0; }

.sidebar-foot { padding: 12px 16px 16px; border-top: 1px solid rgba(255,255,255,0.08); font-size: 12px; color: #6f80a0; }

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 26px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 5;
}
.topbar h1 { font-size: 17px; margin: 0; }
.topbar-title { display:flex; align-items:center; gap:10px; min-width:0; }
.topbar-logo { width:34px; height:34px; object-fit:contain; border:1px solid var(--line); border-radius:6px; background:#fff; padding:2px; }
.topbar-company { font-size:10.5px; color:var(--muted); margin-top:1px; }
.user-chip {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-soft);
}
.avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: var(--navy-800); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 11.5px; font-weight: 700;
}

.content { padding: 24px 26px 60px; max-width: 1180px; width: 100%; margin: 0 auto; }
.company-welcome { display:flex; align-items:center; gap:18px; padding:14px 18px; margin-bottom:20px; }
.dashboard-logo { width:92px; height:58px; object-fit:contain; border:1px solid var(--line); border-radius:7px; background:#fff; padding:3px; flex-shrink:0; }
.company-welcome-name { font-size:18px; font-weight:800; letter-spacing:-0.02em; }
.company-welcome-tagline { font-size:12px; color:var(--blue); font-weight:600; margin-top:1px; }
.company-welcome-text { font-size:12.5px; color:var(--muted); margin-top:3px; }

/* ---------- Components ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.card-pad { padding: 20px 22px; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 22px; }
.stat-card { padding: 16px 18px; }
.stat-card .num { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.stat-card .label { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 8px; border: 1px solid transparent;
  font-size: 13.5px; font-weight: 600; cursor: pointer;
  font-family: inherit;
}
.btn-primary { background: var(--navy-900); color: #fff; }
.btn-primary:hover { background: var(--navy-800); text-decoration: none; }
.btn-amber { background: var(--amber); color: #2c1b00; }
.btn-amber:hover { background: var(--amber-dark); text-decoration: none; color: #fff; }
.btn-ghost { background: transparent; border-color: var(--line); color: var(--ink); }
.btn-ghost:hover { background: var(--bg); text-decoration: none; }
.btn-danger { background: #fdecea; color: var(--red); border-color: #f7cfca; }
.btn-danger:hover { background: #f9d9d5; text-decoration: none; }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }

label { display: block; font-size: 12.6px; font-weight: 600; color: var(--ink-soft); margin: 12px 0 5px; }
label:first-child { margin-top: 0; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=search], select, textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--line); border-radius: 8px;
  font-family: inherit; font-size: 13.8px; background: #fff; color: var(--ink);
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue);
}
textarea { resize: vertical; min-height: 90px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; margin: 12px 0; }
.checkbox-row input { width: auto; }
.checkbox-row label { margin: 0; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }

.pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 600;
  white-space: nowrap;
}
.pill-dot { width: 7px; height: 7px; border-radius: 50%; }

table { width: 100%; border-collapse: collapse; }
th { text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em;
     color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--line); }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); font-size: 13.6px; vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr.row-link { cursor: pointer; }
tr.row-link:hover { background: #f8f9fc; }

.flash-stack { max-width: 1180px; margin: 14px auto 0; padding: 0 26px; }
.flash { padding: 10px 14px; border-radius: 8px; font-size: 13.5px; margin-bottom: 8px; border: 1px solid; }
.flash-success { background: #eafaf0; border-color: #bfead0; color: #146c34; }
.flash-error { background: #fdecea; border-color: #f7cfca; color: #a4291c; }
.flash-info { background: #eaf1fd; border-color: #c4d8f7; color: #1d4ea8; }

.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filter-row select, .filter-row input { width: auto; min-width: 130px; }

.ticket-code {
  display: inline-block; padding: 2px 8px; border-radius: 6px;
  background: var(--navy-950); color: #ffd77a; font-size: 12px; font-weight: 600;
}

.detail-grid { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.subject-line { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.meta-line { font-size: 12.8px; color: var(--muted); margin-bottom: 18px; }

.comment { border-bottom: 1px solid var(--line); padding: 14px 0; }
.comment:last-child { border-bottom: none; }
.comment.internal { background: #fff9ec; border-left: 3px solid var(--amber); padding-left: 12px; margin: 0 -12px 0 -15px; padding-right: 12px; }
.comment-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.comment-author { font-weight: 700; font-size: 13.4px; }
.comment-time { font-size: 12px; color: var(--muted); }
.comment-body { white-space: pre-wrap; font-size: 13.8px; }

.side-field { margin-bottom: 16px; }
.side-field .k { font-size: 11.5px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 4px; }

.activity-item { font-size: 12.6px; color: var(--ink-soft); padding: 6px 0; border-bottom: 1px dashed var(--line); }
.activity-item:last-child { border-bottom: none; }
.activity-time { color: var(--muted); }

.empty-state { text-align: center; padding: 50px 20px; color: var(--muted); }
.empty-state h3 { color: var(--ink); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 18px; }
.tabs a { padding: 9px 14px; font-size: 13.4px; font-weight: 600; color: var(--ink-soft); border-bottom: 2px solid transparent; }
.tabs a.active { color: var(--navy-900); border-bottom-color: var(--amber); }
.tabs a:hover { text-decoration: none; color: var(--ink); }

.pagination { display: flex; gap: 6px; justify-content: center; margin-top: 18px; }
.pagination a, .pagination span { padding: 6px 11px; border-radius: 7px; font-size: 13px; border: 1px solid var(--line); }
.pagination .current { background: var(--navy-900); color: #fff; border-color: var(--navy-900); }

.color-swatch { width: 16px; height: 16px; border-radius: 4px; display: inline-block; vertical-align: middle; border: 1px solid rgba(0,0,0,0.08); }

.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at top, var(--navy-800), var(--navy-950)); }
.auth-card { width: 380px; background: #fff; border-radius: 14px; padding: 32px 30px; box-shadow: 0 20px 60px rgba(0,0,0,0.35); }
.auth-brand { display: flex; align-items: center; gap: 12px; margin-bottom: 22px; }
.auth-logo { width: 64px; height: 48px; object-fit: contain; border: 1px solid var(--line); border-radius: 7px; background: #fff; padding: 3px; }
.auth-company { display:block; font-weight: 800; font-size: 16px; line-height:1.2; }
.auth-brand small { display:block; color:var(--muted); font-size:11px; margin-top:2px; }
.auth-card .btn { width: 100%; justify-content: center; padding: 10px; margin-top: 6px; }
.auth-foot { text-align: center; font-size: 13px; color: var(--muted); margin-top: 16px; }

.help-text { font-size: 12px; color: var(--muted); margin-top: 3px; }

@media (max-width: 860px) {
  .company-welcome { align-items:flex-start; }
  .topbar-company { display:none; }
  .app-shell { flex-direction: column; }
  .sidebar { width: 100%; height: auto; position: relative; }
  .detail-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
}
