:root {
  --font-sans: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  --brand-blue: #0069b3;
  --brand-blue-deep: #0a4f86;
  --brand-navy: #143f72;
  --brand-sky: #5ea3dd;
  --brand-ice: #f3f8fd;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-solid: #fff;
  --border: rgba(13, 67, 115, 0.12);
  --text: #18324f;
  --text-soft: #334f70;
  --text-muted: #5d7490;
  --success: #28a55a;
  --danger: #df4f41;
  --shadow: 0 8px 18px rgba(12, 48, 89, 0.05);
  --radius: 6px;
}

* { box-sizing: border-box; }

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font-sans);
  color: var(--text);
  background: linear-gradient(180deg, #f8fbfe 0%, #eef5fb 100%);
  line-height: 1.55;
}

button,
input,
select {
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

.shell {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  background: rgba(255, 255, 255, 0.9);
  border-right: 1px solid var(--border);
  padding: 0 10px 12px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}

.brand-block {
  margin: 0 -10px 14px;
  padding: 14px 18px 12px;
  color: #fff;
  background: linear-gradient(180deg, var(--brand-blue) 0%, var(--brand-blue-deep) 100%);
}

.brand-logo {
  display: block;
  width: min(184px, 100%);
  height: auto;
}

.brand-block .brand-logo,
.login-logo {
  filter: brightness(0) invert(1);
}

.brand-subtitle {
  margin: 10px 0 0;
  font-size: 0.75rem;
  line-height: 1.15;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sidebar-nav {
  display: grid;
  gap: 2px;
  align-content: start;
  flex: 1;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 8px 9px 10px;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 700;
  border-left: 3px solid transparent;
}

.nav-link:hover,
.nav-link.active {
  background: rgba(0, 105, 179, 0.08);
  color: var(--brand-navy);
  border-left-color: var(--brand-blue);
}

.nav-mark {
  width: 9px;
  height: 9px;
  border: 2px solid currentColor;
  border-radius: 50%;
}

.logout {
  display: block;
  padding: 10px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.main {
  padding: 28px;
  min-width: 0;
}

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.kicker {
  margin: 0 0 4px;
  color: var(--brand-blue);
  font-size: 0.75rem;
  font-weight: 850;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
  color: var(--brand-navy);
  line-height: 1.2;
}

h1 { font-size: 1.85rem; }
h2 { margin-bottom: 14px; font-size: 1.05rem; }

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: minmax(280px, 0.85fr) minmax(420px, 1.15fr);
  align-items: start;
}

.panel {
  background: var(--surface-solid);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}

.panel.compact {
  padding: 14px 18px;
}

.head-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.btn {
  border: 1px solid rgba(0, 105, 179, 0.18);
  border-radius: 4px;
  min-height: 38px;
  padding: 8px 13px;
  color: var(--brand-navy);
  background: #fff;
  font-weight: 800;
  cursor: pointer;
}

.btn.primary {
  border-color: var(--brand-blue);
  color: #fff;
  background: linear-gradient(180deg, #168cff 0%, #066adf 100%);
}

.data-list {
  display: grid;
  gap: 8px;
}

.data-list div {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 10px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(13, 67, 115, 0.08);
}

.data-list span {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.data-list strong {
  min-width: 0;
  overflow-wrap: anywhere;
}

.notice,
.roadmap,
.flash {
  margin-top: 14px;
  padding: 10px 12px;
  border-radius: 5px;
  color: var(--brand-navy);
  background: var(--brand-ice);
  border: 1px solid var(--border);
  font-size: 0.86rem;
  font-weight: 650;
}

.flash {
  margin: 0 0 16px;
}

.flash.success { color: #176637; background: rgba(40, 165, 90, 0.09); }
.flash.danger { color: #9d2c22; background: rgba(223, 79, 65, 0.09); }

.signature-preview {
  overflow: auto;
  padding: 18px;
  background: #fff;
  border: 1px solid rgba(13, 67, 115, 0.1);
  border-radius: 6px;
}

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

.design-option {
  display: grid;
  gap: 4px;
  min-height: 92px;
  align-content: start;
  padding: 12px;
  border: 1px solid rgba(13, 67, 115, 0.12);
  border-left: 4px solid rgba(0, 105, 179, 0.24);
  border-radius: 5px;
  background: #fff;
}

.design-option:hover,
.design-option.active {
  border-color: rgba(0, 105, 179, 0.34);
  border-left-color: var(--brand-blue);
  background: rgba(0, 105, 179, 0.05);
}

.design-option strong {
  color: var(--brand-navy);
  font-size: 0.9rem;
  line-height: 1.2;
}

.design-option span {
  color: var(--text-muted);
  font-size: 0.78rem;
  line-height: 1.35;
}

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

.steps span {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 4px;
  background: rgba(0, 105, 179, 0.07);
  color: var(--brand-navy);
  font-size: 0.82rem;
  font-weight: 800;
}

.form-grid {
  display: grid;
  gap: 11px;
}

.form-grid label {
  display: grid;
  gap: 5px;
}

.form-grid label span {
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 850;
}

.form-grid input,
.form-grid select,
.form-grid textarea {
  min-height: 38px;
  width: 100%;
  border: 1px solid rgba(13, 67, 115, 0.16);
  border-radius: 4px;
  padding: 7px 10px;
  color: var(--text);
  background: #fff;
}

.form-grid textarea {
  min-height: 96px;
  resize: vertical;
}

.form-grid .check {
  grid-template-columns: auto 1fr;
  align-items: center;
}

.form-grid .check input {
  width: auto;
  min-height: auto;
}

.table {
  display: grid;
  border: 1px solid rgba(13, 67, 115, 0.1);
  border-radius: 6px;
  overflow: hidden;
}

.tr {
  display: grid;
  grid-template-columns: 1fr 1fr 0.5fr 1.3fr;
  gap: 10px;
  padding: 10px 12px;
  border-top: 1px solid rgba(13, 67, 115, 0.08);
  font-size: 0.86rem;
}

.compact-table .tr {
  grid-template-columns: 1fr 0.5fr 0.8fr;
}

.tr:first-child { border-top: 0; }
.tr.head { color: var(--brand-navy); background: var(--brand-ice); font-weight: 850; }
.tr span { min-width: 0; overflow-wrap: anywhere; }

.user-editor-list,
.banner-editor-list {
  display: grid;
  gap: 10px;
}

.user-editor {
  border: 1px solid rgba(13, 67, 115, 0.12);
  border-left: 4px solid rgba(0, 105, 179, 0.24);
  border-radius: 5px;
  background: #fff;
  overflow: hidden;
}

.user-editor[open] {
  border-left-color: var(--brand-blue);
  box-shadow: 0 8px 18px rgba(12, 48, 89, 0.04);
}

.user-editor summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  cursor: pointer;
}

.user-editor summary strong,
.user-editor summary span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.user-editor summary strong {
  color: var(--brand-navy);
}

.user-editor summary span {
  color: var(--text-muted);
  font-size: 0.8rem;
  font-weight: 750;
}

.user-edit-form {
  padding: 0 12px 12px;
  border-top: 1px solid rgba(13, 67, 115, 0.08);
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  padding: 10px 14px;
  border-radius: 5px;
  color: #fff;
  background: var(--brand-navy);
  opacity: 0;
  transform: translateY(8px);
  transition: 160ms ease;
  pointer-events: none;
  font-weight: 800;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.login-page {
  background:
    radial-gradient(circle at top right, rgba(94, 163, 221, 0.18), transparent 24%),
    linear-gradient(180deg, #f8fbfe 0%, #eef5fb 100%);
}

.login-shell {
  width: min(100%, 980px);
  min-height: 100vh;
  margin: 0 auto;
  padding: 24px 22px 16px;
  display: grid;
  align-content: center;
  justify-items: center;
  text-align: center;
}

.login-brand-panel h1 {
  margin: 0 0 20px;
  font-size: clamp(15px, 1.55vw, 21px);
  letter-spacing: 0.34em;
  font-weight: 850;
  color: #154d94;
  text-transform: uppercase;
}

.login-card {
  width: min(100%, 480px);
  margin: 0 auto;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(180deg, rgba(11, 85, 178, 0.98), rgba(5, 58, 130, 0.99));
  box-shadow: 0 20px 56px rgba(6, 50, 100, 0.19);
  border: 1px solid rgba(255, 255, 255, 0.44);
}

.login-card-hero {
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 19px 36px 16px;
  background: linear-gradient(180deg, #074994 0%, #07386f 100%);
}

.login-logo {
  display: block;
  width: min(292px, 76%);
  height: auto;
}

.login-card-body {
  padding: 24px 38px 31px;
  background: linear-gradient(180deg, #075eb7 0%, #053b80 100%);
}

.login-inline-status {
  margin: 0 0 15px;
  padding: 7px 11px;
  font-size: 0.78rem;
  font-weight: 750;
  border-radius: 5px;
  text-align: left;
}

.login-inline-status.danger {
  color: #ffd1ca;
  background: rgba(223, 79, 65, 0.12);
  border: 1px solid rgba(223, 79, 65, 0.18);
}

.login-field {
  display: grid;
  gap: 7px;
  margin: 0 0 14px;
  text-align: left;
}

.login-field span {
  color: #fff;
  font-size: 0.78rem;
  font-weight: 800;
}

.login-field-help {
  display: block;
  margin: 12px 0 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 0.75rem;
  line-height: 1.45;
  text-align: left;
}

.login-input {
  width: 100%;
  height: 47px;
  border: 1px solid rgba(0, 50, 110, 0.15);
  border-radius: 5px;
  background: #fff;
  color: #172f50;
  outline: none;
  font-size: 0.92rem;
  font-weight: 550;
  padding: 0 14px;
}

.login-submit {
  width: 100%;
  height: 48px;
  margin-top: 8px;
  border: 0;
  border-radius: 6px;
  cursor: pointer;
  color: #fff;
  font-size: 0.92rem;
  font-weight: 850;
  background: linear-gradient(180deg, #168cff 0%, #066adf 100%);
}

.login-footer {
  margin-top: 15px;
  color: #35577d;
  font-size: 0.75rem;
  font-weight: 650;
}

.login-footer img {
  height: 32px;
  width: auto;
}

@media (max-width: 900px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar-nav {
    display: flex;
    overflow-x: auto;
  }

  .grid.two {
    grid-template-columns: 1fr;
  }

  .design-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .main {
    padding: 18px;
  }

  .page-head {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .tr,
  .compact-table .tr {
    grid-template-columns: 1fr;
  }

  .signature-preview {
    padding: 10px;
  }

  .design-list {
    grid-template-columns: 1fr;
  }
}
