:root {
  --bg: #f3f5f8;
  --panel: #ffffff;
  --ink: #171717;
  --muted: #667085;
  --line: #dde3ec;
  --accent: #c1121f;
  --accent-dark: #8f0d17;
  --ok: #0f7a3d;
  --warn: #9a6500;
  --bad: #9b111e;
  --shadow: 0 12px 34px rgba(0,0,0,.08);
}

* { box-sizing: border-box; }

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(193,18,31,.10), transparent 34rem),
    linear-gradient(180deg, #ffffff 0, var(--bg) 36rem);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}

a { color: var(--accent); text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(8, 8, 8, .96);
  color: #fff;
  border-bottom: 3px solid var(--accent);
  box-shadow: 0 14px 35px rgba(0,0,0,.18);
  backdrop-filter: blur(10px);
}

.topbar-inner {
  max-width: 1180px;
  margin: 0 auto;
  padding: 14px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.brand img {
  height: 48px;
  width: auto;
  background: #fff;
  border-radius: 8px;
  padding: 6px;
  box-shadow: 0 8px 24px rgba(0,0,0,.26);
}

.brand-text {
  min-width: 0;
}

.brand-title {
  font-weight: 800;
  font-size: 17px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.brand-sub {
  font-size: 12px;
  color: #cfcfcf;
}

.nav {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.nav a,
.btn,
button {
  display: inline-flex;
  min-height: 42px;
  align-items: center;
  justify-content: center;
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  font-weight: 800;
  font-size: 14px;
  cursor: pointer;
  text-decoration: none;
}

.nav a,
.btn.secondary,
button.secondary {
  background: #eeeeee;
  color: #111;
}

.nav a {
  background: rgba(255,255,255,.12);
  color: #fff;
}

.nav a:hover,
.nav a:focus-visible {
  background: #fff;
  color: #111;
}

.btn.primary,
button.primary {
  background: var(--accent);
  color: #fff;
}

.btn.black,
button.black {
  background: #111;
  color: #fff;
}

.btn.danger,
button.danger {
  background: var(--bad);
  color: #fff;
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 22px 18px 52px;
}

.login-shell {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    radial-gradient(circle at center top, rgba(193,18,31,.28), transparent 30rem),
    linear-gradient(135deg, #070707, #2b0208);
}

.login-card {
  width: min(560px, 100%);
  background: var(--panel);
  border: 1px solid rgba(255,255,255,.45);
  border-radius: 8px;
  box-shadow: 0 26px 80px rgba(0,0,0,.28);
  padding: 30px;
}

.login-logo {
  text-align: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  margin-bottom: 22px;
  box-shadow: 0 10px 28px rgba(17,24,39,.08);
}

.login-logo img {
  max-height: 82px;
  max-width: 100%;
}

h1 {
  margin: 0 0 10px;
  font-size: 36px;
  line-height: 1.1;
}

h2 {
  margin: 0 0 14px;
}

.sub {
  color: var(--muted);
  margin-top: 0;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: .11em;
  text-transform: uppercase;
}

.hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  background:
    linear-gradient(135deg, #ffffff 0, #ffffff 58%, #f9e7ea 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 22px;
  box-shadow: 0 14px 38px rgba(17,24,39,.08);
}

.hero .sub {
  max-width: 700px;
  margin-bottom: 0;
}

.hero-logo {
  flex: 0 0 auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 16px 34px rgba(17,24,39,.10);
}

.hero-logo img {
  display: block;
  width: min(210px, 32vw);
  height: auto;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.col-4 { grid-column: span 4; }
.col-5 { grid-column: span 5; }
.col-6 { grid-column: span 6; }
.col-7 { grid-column: span 7; }
.col-8 { grid-column: span 8; }
.col-12 { grid-column: span 12; }

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 10px 28px rgba(17,24,39,.06);
}

.stack {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.full { grid-column: 1 / -1; }

.form-hint {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.requester-box {
  border: 1px solid #f0c6cb;
  border-left: 5px solid var(--accent);
  background: #fff7f8;
  border-radius: 8px;
  padding: 14px;
}

label {
  display: block;
  font-weight: 800;
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px 12px;
  font: inherit;
  background: #fff;
}

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

.flash {
  border-radius: 8px;
  padding: 13px 15px;
  margin-bottom: 16px;
  background: #eaf8ef;
  color: var(--ok);
  font-weight: 700;
}

.flash.err {
  background: #ffe8e8;
  color: var(--bad);
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 20px rgba(17,24,39,.05);
}

.stat strong {
  display: block;
  font-size: 30px;
  color: var(--accent);
}

.ticket-list {
  display: grid;
  gap: 12px;
}

.ticket {
  background: linear-gradient(180deg, #ffffff, #fbfcfe);
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 20px rgba(17,24,39,.05);
}

.ticket-head {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.ticket-title {
  font-size: 18px;
  font-weight: 900;
  margin: 0 0 4px;
}

.meta {
  color: var(--muted);
  font-size: 13px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
}

.badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.badge {
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 900;
  background: #eeeeee;
}

.badge.ok { background: #eaf8ef; color: var(--ok); }
.badge.warn { background: #fff3d6; color: var(--warn); }
.badge.bad { background: #ffe8e8; color: var(--bad); }
.badge.black { background: #111; color: #fff; }

.ticket-body {
  margin-top: 12px;
  color: #2a2a2a;
  white-space: pre-wrap;
  background: #f8fafc;
  border: 1px solid #edf1f6;
  border-radius: 8px;
  padding: 12px;
}

.ticket-actions {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  align-items: end;
}

.history {
  margin: 12px 0 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 13px;
}

.history li {
  padding: 6px 0;
  border-top: 1px solid #eeeeee;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 11px;
  border-bottom: 1px solid #eeeeee;
  text-align: left;
  vertical-align: top;
}

th {
  background: #fafafa;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.inline-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.manager-grid {
  align-items: start;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.section-head h2 {
  margin-bottom: 0;
}

.mini-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.mini-stat {
  background: #f8fafc;
  border: 1px solid #e7edf5;
  border-radius: 8px;
  padding: 12px;
}

.mini-stat span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.mini-stat strong {
  display: block;
  margin-top: 4px;
  color: var(--accent);
  font-size: 23px;
}

.satisfaction-list {
  display: grid;
  gap: 10px;
}

.satisfaction-item {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.satisfaction-comment {
  margin: 10px 0 0;
  color: #303744;
  background: #f8fafc;
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  padding: 10px 12px;
}

.rating-badge {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 58px;
  min-height: 42px;
  background: #111827;
  color: #fff;
  border-radius: 999px;
  font-weight: 900;
}

.export-actions {
  display: grid;
  gap: 12px;
}

.export-card {
  display: block;
  border: 1px solid var(--line);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 8px 18px rgba(17,24,39,.05);
}

.export-card strong,
.export-card span {
  display: block;
}

.export-card strong {
  font-size: 18px;
  margin-bottom: 5px;
}

.export-card span {
  color: var(--muted);
}

.export-card:hover,
.export-card:focus-visible {
  border-color: var(--accent);
  box-shadow: 0 14px 30px rgba(193,18,31,.12);
}

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

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

@media (max-width: 900px) {
  .topbar-inner {
    align-items: flex-start;
    flex-direction: column;
  }

  .nav {
    width: 100%;
    justify-content: stretch;
  }

  .nav a,
  .nav .btn {
    flex: 1 1 130px;
  }

  .col-4,
  .col-5,
  .col-6,
  .col-7,
  .col-8,
  .col-12 {
    grid-column: 1 / -1;
  }

  .stats,
  .form-grid,
  .ticket-actions,
  .mini-stats {
    grid-template-columns: 1fr;
  }

  .hero,
  .section-head,
  .satisfaction-item {
    display: block;
  }

  .hero-logo {
    margin-top: 14px;
    display: inline-block;
  }

  .hero-logo img {
    width: min(210px, 70vw);
  }

  .rating-badge {
    margin-top: 10px;
  }

  .ticket-head {
    display: block;
  }

  .badges {
    margin-top: 10px;
  }

  .login-card {
    border-radius: 0;
    min-height: 100dvh;
  }

  .login-shell {
    padding: 0;
  }
}

@media (max-width: 520px) {
  .wrap {
    padding: 16px 12px 42px;
  }

  h1 {
    font-size: 29px;
  }

  .brand img {
    height: 40px;
  }

  .brand-sub {
    display: none;
  }

  .card,
  .ticket {
    border-radius: 8px;
    padding: 14px;
  }
}
