:root {
  --navy: #102f43;
  --navy-2: #1f567c;
  --red: #ef2430;
  --ink: #173042;
  --muted: #667d8b;
  --line: #dbe6ea;
  --surface: #ffffff;
  --canvas: #f3f7f8;
  --shadow: 0 18px 45px rgba(16, 47, 67, .08);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; }
a { color: inherit; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: 72px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 max(24px, calc((100vw - 1120px) / 2));
  color: #fff;
  background: rgba(12, 39, 56, .97);
  box-shadow: 0 8px 30px rgba(4, 21, 31, .15);
  backdrop-filter: blur(16px);
}

.brand { display: inline-flex; align-items: center; gap: 11px; width: max-content; font-weight: 800; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; background: var(--red); font-size: 13px; letter-spacing: .05em; }
.nav-links { display: flex; align-self: stretch; }
.nav-links a { display: flex; align-items: center; padding: 0 20px; border-bottom: 3px solid transparent; color: #bdd0da; font-size: 14px; font-weight: 700; text-decoration: none; }
.nav-links a:hover, .nav-links a.active { color: #fff; border-bottom-color: var(--red); }
.signout { justify-self: end; padding: 9px 14px; border: 1px solid #476576; border-radius: 9px; color: #d9e5eb; font-size: 13px; font-weight: 700; text-decoration: none; }
.signout:hover { border-color: #fff; color: #fff; }

.shell { max-width: 1120px; margin: auto; padding: 52px 24px 80px; }
.page-header { display: flex; align-items: flex-end; gap: 18px; margin-bottom: 30px; }
.page-header > div:first-child { flex: 1; }
.eyebrow { color: var(--red); font-size: 11px; font-weight: 900; letter-spacing: .18em; }
h1 { margin: 9px 0 10px; font-size: clamp(36px, 5vw, 54px); line-height: 1.02; letter-spacing: -.035em; }
h2 { margin: 4px 0; font-size: 24px; letter-spacing: -.02em; }
p { line-height: 1.55; }
.page-header p, .admin-hero p { margin: 0; color: var(--muted); }
.header-stat { min-width: 120px; padding: 16px 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(255,255,255,.65); }
.header-stat strong { display: block; color: var(--navy-2); font-size: 24px; }
.header-stat span { color: var(--muted); font-size: 12px; }
.company-switcher { min-width: 270px; }

.card { margin-bottom: 22px; padding: 30px; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); box-shadow: var(--shadow); }
.section-heading { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.section-heading > div:first-child { flex: 1; }
.section-heading.compact { margin-bottom: 18px; }
.step-pill, .count { padding: 7px 10px; border-radius: 999px; color: var(--navy-2); background: #edf5f8; font-size: 11px; font-weight: 800; }
.form-section { margin: 30px -30px 0; padding: 30px; border-top: 1px solid #e7eef1; }

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.clients { grid-template-columns: repeat(3, minmax(0, 1fr)); }
label { color: #30485a; font-size: 12px; font-weight: 800; letter-spacing: .015em; }
input, select, textarea { display: block; width: 100%; margin-top: 8px; padding: 12px 13px; border: 1px solid #cadbe2; border-radius: 10px; outline: none; color: var(--ink); background: #fff; font: inherit; transition: .18s border, .18s box-shadow; }
input:focus, select:focus, textarea:focus { border-color: var(--navy-2); box-shadow: 0 0 0 3px rgba(31, 86, 124, .12); }
textarea { min-height: 150px; resize: vertical; font: 12px Consolas, monospace; }
.company-select { display: block; max-width: 520px; }

.choice { position: relative; display: flex; align-items: center; gap: 13px; min-height: 88px; padding: 16px; border: 1px solid #cfdee3; border-radius: 14px; cursor: pointer; transition: .18s transform, .18s border, .18s background; }
.choice:hover { transform: translateY(-2px); border-color: #9fb8c5; }
.choice:has(input:checked) { border-color: var(--navy-2); background: #f1f7fa; box-shadow: inset 0 0 0 1px var(--navy-2); }
.choice input { position: absolute; opacity: 0; width: 1px; }
.choice strong, .choice small { display: block; }
.choice small { margin-top: 4px; color: var(--muted); font-weight: 500; }
.client-icon { display: grid; place-items: center; flex: 0 0 42px; height: 42px; border-radius: 11px; color: #fff; background: var(--navy-2); font-size: 13px; font-weight: 900; }
.choice:has(input:checked) .client-icon { background: var(--red); }
.field-help { margin: 14px 0 0; color: var(--muted); font-size: 12px; }

button { border: 0; border-radius: 10px; padding: 12px 18px; color: #fff; background: var(--navy-2); font-weight: 800; cursor: pointer; }
button:hover { filter: brightness(.94); }
.form-actions { display: flex; align-items: center; justify-content: flex-end; gap: 22px; margin: 0 -30px -30px; padding: 22px 30px; border-radius: 0 0 20px 20px; background: #f8fafb; }
.form-actions span { margin-right: auto; color: var(--muted); font-size: 12px; }
.form-actions button { padding: 14px 22px; background: var(--red); }
.form-actions button b { margin-left: 8px; }
.secondary { margin-left: 8px; color: var(--navy-2); background: #edf4f6; }
.icon-button { display: grid; place-items: center; width: 34px; height: 34px; padding: 0; border-radius: 9px; font-size: 20px; }
.icon-button.danger { color: #c52a35; background: #fff0f1; }

.result-head { display: flex; align-items: center; margin-bottom: 20px; }
.result-head > div { margin-right: auto; }
.preview-label { margin-bottom: 8px; color: var(--muted); font-size: 10px; font-weight: 900; letter-spacing: .14em; }
.preview { min-height: 170px; padding: 26px; overflow: auto; border: 1px solid #e1eaee; border-radius: 12px; background: #fff; }
details { margin-top: 18px; }
summary { color: var(--navy-2); font-weight: 800; cursor: pointer; }
.hint, .error { font-size: 13px; }
.hint { color: var(--muted); }
.error { color: #bd2430; }
.notice { padding: 13px 16px; border-radius: 11px; background: #fff; }
.notice.success { border: 1px solid #a6d7ba; color: #176739; }
.notice.error { border: 1px solid #efb0b0; }

.admin-hero { display: flex; align-items: center; gap: 20px; padding: 22px 26px; }
.company-initial { display: grid; place-items: center; width: 62px; height: 62px; border-radius: 16px; color: #fff; background: linear-gradient(145deg, var(--navy-2), var(--navy)); font-size: 20px; font-weight: 900; }
.asset-columns { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; align-items: start; }
.asset-panel { margin: 0; }
.upload-form { display: grid; gap: 14px; padding: 18px; border: 1px solid #dbe7eb; border-radius: 14px; background: #f8fbfc; }
.file-picker { position: relative; display: grid; justify-items: center; padding: 22px; border: 1.5px dashed #9db6c3; border-radius: 12px; text-align: center; cursor: pointer; }
.file-picker:hover { border-color: var(--navy-2); background: #eef6f9; }
.file-picker input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.file-picker strong { color: var(--navy-2); font-size: 13px; }
.file-picker small { margin-top: 4px; color: var(--muted); font-weight: 500; }
.file-icon { display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 9px; border-radius: 10px; color: #fff; background: var(--navy-2); font-size: 20px; }
.asset-list { display: grid; gap: 10px; margin-top: 18px; }
.asset-card { display: grid; grid-template-columns: 70px 1fr auto; align-items: center; gap: 13px; padding: 10px; border: 1px solid #e0e9ed; border-radius: 12px; }
.asset-preview { display: grid; place-items: center; height: 54px; padding: 5px; overflow: hidden; border-radius: 8px; background: #f0f4f6; }
.asset-preview img { max-width: 100%; max-height: 100%; object-fit: contain; }
.asset-preview.wide img { width: 100%; height: 100%; object-fit: cover; }
.asset-meta { min-width: 0; }
.asset-meta strong, .asset-meta small { display: block; }
.asset-meta small { margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.empty-state { padding: 30px 16px; border: 1px dashed #c8d8df; border-radius: 13px; color: var(--muted); text-align: center; }
.empty-state span { display: block; color: #90a8b4; font-size: 26px; }
.empty-state strong { display: block; margin-top: 8px; color: var(--ink); }
.empty-state p { margin: 5px 0 0; font-size: 12px; }

.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 25% 10%, #e0edf2, transparent 42%), var(--canvas); }
.login-card { width: min(430px, 100%); padding: 38px; border: 1px solid var(--line); border-radius: 22px; background: #fff; box-shadow: 0 24px 70px rgba(16, 47, 67, .14); }
.login-card h1 { font-size: 36px; }
.login-card > p { margin-bottom: 24px; color: var(--muted); }
.login-card button { width: 100%; margin-top: 18px; background: var(--red); }

@media (max-width: 820px) {
  .topbar { grid-template-columns: 1fr auto; padding: 0 18px; }
  .nav-links { position: fixed; left: 0; right: 0; bottom: 0; z-index: 60; justify-content: center; height: 58px; background: var(--navy); }
  .nav-links a { padding: 0 24px; }
  .shell { padding: 34px 18px 90px; }
  .page-header { align-items: stretch; flex-wrap: wrap; }
  .page-header > div:first-child { flex-basis: 100%; }
  .company-switcher { width: 100%; }
  .clients, .asset-columns { grid-template-columns: 1fr; }
}

@media (max-width: 600px) {
  .brand > span:last-child { display: none; }
  .grid { grid-template-columns: 1fr; }
  .card { padding: 22px; border-radius: 16px; }
  .form-section { margin: 26px -22px 0; padding: 24px 22px; }
  .form-actions { display: block; margin: 0 -22px -22px; padding: 18px 22px; }
  .form-actions button { width: 100%; margin-top: 14px; }
  .header-stat { flex: 1; min-width: 0; }
  .result-head { display: block; }
  .secondary { margin: 14px 6px 0 0; }
  .admin-hero { align-items: flex-start; }
}
