/* Theme: New Progress Group navy (#303691, taken from the logo) on a cool grey page. */
:root {
  --brand: #303691;
  --brand-dark: #252a75;
  --brand-soft: #eceefa;
  --brand-line: #cfd3f0;

  --ink: #171a2b;
  --muted: #646b82;
  --line: #e3e6ef;
  --page: #f4f5fa;
  --surface: #fff;

  --green: #17713c;   --green-soft: #dcf3e4;
  --amber: #8a5a00;   --amber-soft: #fdf1d3;
  --orange: #b0501d;  --orange-soft: #fde8da;
  --red: #b3261e;     --red-soft: #fbe0dd;
  --blue: #1c5fb8;    --blue-soft: #e2eefd;
  --violet: #5b3bb0;  --violet-soft: #efe9fb;
  --grey: #4b5468;    --grey-soft: #eceff4;

  --radius: 12px;
  --shadow: 0 1px 2px rgb(23 26 43 / 0.05), 0 4px 16px rgb(23 26 43 / 0.04);
}

* { box-sizing: border-box; }

html { background: var(--page); }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.6rem; line-height: 1.25; margin: 0; letter-spacing: -0.01em; }
h2 { font-size: 1.05rem; margin: 0 0 1rem; }
h3 { font-size: .75rem; margin: 1.25rem 0 .35rem; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .05em; }
small { font-size: .8rem; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }
.required { color: var(--red); }

/* --- Header ---------------------------------------------------------------- */

.topbar { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { max-width: 1240px; margin: 0 auto; padding: 0 1.5rem; display: flex; align-items: center; gap: 2rem; min-height: 64px; }

.brand { display: flex; align-items: center; gap: .75rem; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand img { height: 40px; width: auto; }
.brand span { display: flex; flex-direction: column; line-height: 1.2; }
.brand strong { font-size: 1.05rem; color: var(--brand); }
.brand small { color: var(--muted); font-size: .72rem; }

.tabs { display: flex; gap: .25rem; flex: 1; align-self: stretch; }
.tabs a { display: flex; align-items: center; padding: 0 .9rem; color: var(--muted); font-weight: 500; border-bottom: 3px solid transparent; border-top: 3px solid transparent; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.active { color: var(--brand); border-bottom-color: var(--brand); }
.pill { margin-left: .4rem; padding: 0 .45rem; border-radius: 999px; background: var(--amber); color: #fff; font-size: .72rem; font-weight: 700; line-height: 1.5; }

.account { display: flex; align-items: center; gap: .6rem; margin: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 600; }
.who { display: flex; flex-direction: column; line-height: 1.2; font-size: .9rem; }
.who small { color: var(--muted); font-size: .72rem; }

@media (max-width: 760px) {
  .topbar-inner { flex-wrap: wrap; gap: .25rem 1rem; padding-top: .5rem; }
  .brand small, .who { display: none; }
  .tabs { order: 3; flex-basis: 100%; overflow-x: auto; }
  .tabs a { padding: .6rem .7rem; white-space: nowrap; }
  .account { margin-left: auto; }
}

/* --- Layout ---------------------------------------------------------------- */

main { max-width: 1240px; margin: 0 auto; padding: 2rem 1.5rem 4rem; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.5rem; box-shadow: var(--shadow); }
.panel.narrow { max-width: 460px; margin: 3rem auto; }
.panel-head { margin-bottom: 1.5rem; padding-bottom: 1.25rem; border-bottom: 1px solid var(--line); }
.panel-head p { margin: .4rem 0 0; }
.panel-head.with-icon { display: flex; align-items: flex-start; gap: 1rem; }
.form-panel { max-width: 760px; }

.columns { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 1.25rem; align-items: start; margin-top: 1.25rem; }
@media (max-width: 900px) { .columns { grid-template-columns: 1fr; } }

.page-head, .section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .75rem; margin-bottom: 1rem; }
.section-head { margin-top: 2.25rem; }
.section-head h2 { margin: 0; }
h3.group { margin: 1.5rem 0 .6rem; font-size: .8rem; }
.section-head + h3.group { margin-top: .25rem; }
.page-actions { display: flex; gap: .5rem; flex-wrap: wrap; }
.count { display: inline-block; vertical-align: middle; margin-left: .35rem; padding: .1rem .6rem; border-radius: 999px; background: var(--brand-soft); color: var(--brand); font-size: .85rem; font-weight: 600; letter-spacing: 0; }
.back { display: inline-block; margin-bottom: .9rem; color: var(--muted); font-size: .9rem; }

/* --- Home ------------------------------------------------------------------ */

.hero { margin-bottom: 1.5rem; }
.hero p { margin: .35rem 0 0; color: var(--muted); font-size: 1.02rem; }

/* Four request types to a row, so each group of types sits on one line. */
.choices { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; }
@media (max-width: 1040px) { .choices { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 560px) { .choices { grid-template-columns: 1fr; } }
.choice { display: flex; flex-direction: column; gap: .8rem; padding: 1.15rem 1.25rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); color: var(--muted); font-size: .88rem; line-height: 1.45; transition: border-color .15s, transform .15s, box-shadow .15s; }
.choice:hover { text-decoration: none; border-color: var(--brand); transform: translateY(-2px); box-shadow: 0 6px 24px rgb(48 54 145 / 0.12); }
.choice strong { display: block; color: var(--ink); font-size: 1rem; line-height: 1.3; margin-bottom: .3rem; }
.icon { flex: none; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; }
.icon-fix { background: var(--orange-soft); color: var(--orange); }
.icon-dev { background: var(--brand-soft); color: var(--brand); }
.icon-access { background: var(--green-soft); color: var(--green); }
.icon-workflow { background: var(--violet-soft); color: var(--violet); }
.icon-server, .icon-hardware, .icon-m365, .icon-software, .icon-admin { background: var(--blue-soft); color: var(--blue); }
.icon-vpn { background: var(--red-soft); color: var(--red); }
.hero + h3.group { margin-top: 0; }

.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 1rem; margin-top: 2rem; }
.stat { display: flex; flex-direction: column; padding: 1rem 1.25rem; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); color: var(--muted); font-size: .88rem; }
.stat:hover { text-decoration: none; border-color: var(--brand-line); }
.stat b { font-size: 1.7rem; line-height: 1.2; color: var(--ink); font-variant-numeric: tabular-nums; }
.stat.staff { background: var(--brand-soft); border-color: var(--brand-line); }
.stat.staff b { color: var(--brand); }
.stat.alert { background: var(--amber-soft); border-color: #f0d691; }
.stat.alert b { color: var(--amber); }

/* --- Buttons --------------------------------------------------------------- */

button { font: inherit; cursor: pointer; }
.btn, button.ghost { display: inline-flex; align-items: center; justify-content: center; gap: .55rem; padding: .55rem 1.1rem; border-radius: 8px; border: 1px solid transparent; font-weight: 600; font-size: .92rem; line-height: 1.4; transition: background .15s, border-color .15s; }
.btn:hover { text-decoration: none; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.secondary { background: var(--surface); border-color: var(--line); color: var(--ink); }
.btn.secondary:hover { border-color: var(--brand); color: var(--brand); }
.btn.danger { background: var(--surface); border-color: #e7b1ab; color: var(--red); }
.btn.danger:hover { background: var(--red-soft); }
.btn.ghost, button.ghost { background: none; color: var(--muted); }
.btn.ghost:hover, button.ghost:hover { background: var(--grey-soft); color: var(--ink); }
.btn.microsoft { background: var(--surface); border-color: #8c8c8c; color: #3c3c3c; padding: .7rem 1.1rem; }
.btn.microsoft:hover { background: #f3f3f3; }
.btn.wide { width: 100%; }
:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

/* --- Forms ----------------------------------------------------------------- */

label { font-weight: 600; font-size: .88rem; }
input, select, textarea { font: inherit; font-weight: 400; width: 100%; min-height: 2.6rem; padding: .5rem .7rem; border: 1px solid #cfd4e0; border-radius: 8px; background: var(--surface); color: inherit; transition: border-color .15s, box-shadow .15s; }
textarea { resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgb(48 54 145 / 0.15); }
input[type="file"] { padding: .4rem; background: var(--page); border-style: dashed; }
input[type="file"]::file-selector-button { font: inherit; font-weight: 600; margin-right: .75rem; padding: .35rem .8rem; border: 1px solid var(--line); border-radius: 6px; background: var(--surface); color: var(--ink); cursor: pointer; }

.stack { display: flex; flex-direction: column; gap: .9rem; }
.stack label { display: flex; flex-direction: column; gap: .3rem; }

.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1.1rem 1rem; }
.field { display: flex; flex-direction: column; gap: .3rem; grid-column: 1 / -1; min-width: 0; }
.form-panel .field-company, .form-panel .field-module { grid-column: auto; }
.form-grid.two { align-items: end; }
.form-grid.two .field { grid-column: auto; }
.form-grid.two .field-staff_note { grid-column: 1 / -1; }
.form-grid > .errorlist, .form-grid .actions { grid-column: 1 / -1; }
@media (max-width: 560px) { .form-grid { grid-template-columns: 1fr; } .form-grid .field { grid-column: 1 / -1 !important; } }

.has-error input, .has-error select, .has-error textarea { border-color: var(--red); }
.help { color: var(--muted); font-weight: 400; }
.fixed-approver { margin: 0; padding: .55rem .7rem; border: 1px solid var(--line); border-radius: 8px; background: var(--page); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.lead { margin: -.25rem 0 1rem; }
.errorlist { margin: 0; padding: 0; list-style: none; color: var(--red); font-size: .85rem; font-weight: 500; }
.actions { display: flex; gap: .5rem; align-items: center; margin-top: .25rem; }

.filters { display: grid; grid-template-columns: 2fr repeat(4, 1fr) auto; gap: .9rem; align-items: end; padding: 1rem 1.25rem; margin-bottom: 1.25rem; }
.filters label { display: flex; flex-direction: column; gap: .3rem; color: var(--muted); font-size: .78rem; }
.filters input, .filters select { font-size: .92rem; color: var(--ink); }
.filter-actions { display: flex; gap: .25rem; }
.search { display: flex; gap: .5rem; padding: .75rem; margin-bottom: 1.25rem; }
.search input { flex: 1; min-width: 0; }
@media (max-width: 1000px) { .filters { grid-template-columns: 1fr 1fr; } .filter-q, .filter-actions { grid-column: 1 / -1; } }

/* --- Tables ---------------------------------------------------------------- */

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: .8rem 1rem; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
th { background: #fafbfd; font-size: .72rem; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; white-space: nowrap; }
/* Fixed widths for everything but the request text, so stacked tables line up. */
th:nth-child(1) { width: 130px; }
th:nth-child(3) { width: 185px; }
th:nth-child(4) { width: 215px; }
th:nth-child(5) { width: 150px; }
th:nth-child(6) { width: 150px; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfe; }
td small { display: block; margin-top: .15rem; color: var(--muted); }
td.summary { min-width: 280px; }
td.summary a { color: var(--ink); }
td.summary a:hover { color: var(--brand); }
td.empty { padding: 2.5rem 1rem; text-align: center; color: var(--muted); }
.ticket-id { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; font-weight: 600; font-size: .92rem; }

.kind { font-weight: 600; text-transform: uppercase; letter-spacing: .05em; font-size: .68rem; }
td .kind, .kind { color: var(--blue); }
td .kind.kind-fix, .kind-fix { color: var(--orange); }
td .kind.kind-dev, .kind-dev { color: var(--brand); }
td .kind.kind-access, .kind-access { color: var(--green); }
td .kind.kind-workflow, .kind-workflow { color: var(--violet); }
td .kind.kind-vpn, .kind-vpn { color: var(--red); }
/* The VPN list has its own columns, so the widths above do not apply to it. */
table.vpn th:nth-child(n) { width: auto; }
td small.expired { color: var(--red); font-weight: 600; }

.pagination { display: flex; gap: 1.25rem; justify-content: center; align-items: center; margin: 1.25rem 0; color: var(--muted); }

/* --- Badges ---------------------------------------------------------------- */

.badge { display: inline-flex; align-items: center; gap: .4rem; padding: .18rem .65rem; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; background: var(--grey-soft); color: var(--grey); }
.badge i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.status-awaiting { background: var(--amber-soft); color: var(--amber); }
.status-rejected { background: var(--red-soft); color: var(--red); }
.status-not_started { background: var(--grey-soft); color: var(--grey); }
.status-analysis { background: var(--violet-soft); color: var(--violet); }
.status-in_progress { background: var(--blue-soft); color: var(--blue); }
.status-testing { background: var(--amber-soft); color: var(--amber); }
.status-done { background: var(--green-soft); color: var(--green); }
.status-returned { background: var(--red-soft); color: var(--red); }
.priority-1 { background: var(--green-soft); color: var(--green); }
.priority-2 { background: var(--amber-soft); color: var(--amber); }
.priority-3 { background: var(--orange-soft); color: var(--orange); }
.priority-4 { background: var(--red-soft); color: var(--red); }

/* --- Ticket page ----------------------------------------------------------- */

.ticket-title { display: flex; justify-content: space-between; align-items: flex-start; gap: 1rem; }
.ticket-title h1 { font-family: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace; font-size: 1.7rem; margin: .1rem 0; }
.ticket-title p { margin: 0; }
.ticket-title .badge { font-size: .9rem; padding: .3rem .9rem; }
.waiting-note { margin: 1.25rem 0 0; padding: .7rem 1rem; border-radius: 8px; background: var(--amber-soft); color: var(--amber); font-weight: 500; }
.returned-note { margin: 1.25rem 0 0; padding: .7rem 1rem; border-radius: 8px; background: var(--red-soft); color: var(--red); font-weight: 500; }

/* Progress bar: a dot per stage, joined by a line that fills as the ticket moves on. */
.steps { display: flex; list-style: none; margin: 1.5rem 0 0; padding: 0; }
.steps li { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: .45rem; text-align: center; font-size: .8rem; color: var(--muted); }
.steps li::before { content: ""; position: absolute; top: 8px; right: 50%; width: 100%; height: 3px; background: var(--line); }
.steps li:first-child::before { display: none; }
.steps i { position: relative; z-index: 1; width: 19px; height: 19px; border-radius: 50%; background: var(--surface); border: 3px solid var(--line); }
.steps .done::before, .steps .current::before { background: var(--brand); }
.steps .done i { background: var(--brand); border-color: var(--brand); }
.steps .current i { border-color: var(--brand); box-shadow: 0 0 0 4px var(--brand-soft); }
.steps .done, .steps .current { color: var(--ink); }
.steps .current span { font-weight: 700; color: var(--brand); }

.prose { margin: 0; overflow-wrap: anywhere; }
.files { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: .35rem; }
.files li:not(.muted) { padding: .5rem .75rem; border: 1px solid var(--line); border-radius: 8px; background: var(--page); }

.facts { display: flex; flex-wrap: wrap; gap: 1rem 2.5rem; margin: 1.5rem 0 0; padding-top: 1.25rem; border-top: 1px solid var(--line); }
.facts.stacked { flex-direction: column; gap: 0; margin: 0; padding: 0; border: 0; }
.facts.stacked > div { display: flex; justify-content: space-between; gap: 1rem; padding: .65rem 0; border-bottom: 1px solid var(--line); }
.facts.stacked > div:last-child { border-bottom: 0; }
.facts.stacked dd { text-align: right; }
dt { color: var(--muted); font-size: .85rem; }
dd { margin: 0; font-weight: 500; }

/* --- Messages -------------------------------------------------------------- */

.flash { padding: .75rem 1rem; border-radius: 10px; border: 1px solid var(--brand-line); background: var(--brand-soft); color: var(--brand-dark); margin: 0 0 1.25rem; font-weight: 500; }
.flash.success { background: var(--green-soft); border-color: #b5e2c6; color: var(--green); }
.flash.error { background: var(--red-soft); border-color: #f3bdb7; color: var(--red); }

/* --- Sign-in --------------------------------------------------------------- */

body.entrance { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(1200px 600px at 50% -10%, #dfe3fa 0%, var(--page) 60%); }
body.entrance main { width: 100%; padding: 1.5rem; }
.login { max-width: 420px; margin: 0 auto; padding: 2.25rem 2rem; text-align: center; }
.login-logo { height: 96px; width: auto; margin-bottom: .5rem; }
.login h1 { color: var(--brand); }
.login > .muted { margin: .35rem 0 1.75rem; }
.login form { text-align: left; }
.hint { margin: .9rem 0 0; font-size: .82rem; color: var(--muted); }
.divider { display: flex; align-items: center; gap: .75rem; margin: 1.25rem 0; color: var(--muted); font-size: .8rem; }
.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.allauth h1 { margin-bottom: 1rem; }
