:root {
  --bg: #eef2f6;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-3: #edf3f8;
  --text: #1e293b;
  --muted: #64748b;
  --line: #d9e2ec;
  --ink: #0f172a;
  --sidebar: #101c2f;
  --sidebar-2: #18263d;
  --primary: #0f766e;
  --primary-strong: #0b5f59;
  --blue: #2563eb;
  --accent: #b7791f;
  --danger: #b42318;
  --success: #16803c;
  --warning: #b7791f;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 22px rgba(15, 23, 42, 0.06);
  --radius: 8px;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, "Segoe UI", Tahoma, Arial, sans-serif;
  letter-spacing: 0;
}

body {
  min-height: 100vh;
  margin: 0;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease, box-shadow 140ms ease;
}

button:hover {
  border-color: var(--primary);
  box-shadow: var(--shadow-soft);
}

button:active {
  transform: translateY(1px);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(37, 99, 235, 0.18);
  outline-offset: 2px;
  border-color: var(--blue);
}

button.primary {
  border-color: var(--primary);
  background: var(--primary);
  color: #fff;
  font-weight: 700;
}

button.primary:hover {
  background: var(--primary-strong);
}

button.danger {
  border-color: rgba(180, 35, 24, 0.25);
  background: #fff7f7;
  color: var(--danger);
}

button.compact {
  min-height: 32px;
  padding: 0 10px;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
}

.icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.9;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.icon-button {
  display: inline-grid;
  width: 40px;
  min-width: 40px;
  height: 40px;
  min-height: 40px;
  place-items: center;
  padding: 0;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--text);
  padding: 9px 11px;
}

select {
  color: var(--ink);
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.92rem;
}

label span {
  color: var(--muted);
}

.toast {
  position: fixed;
  inset-block-start: 16px;
  inset-inline: 16px;
  z-index: 20;
  max-width: 620px;
  margin-inline: auto;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  box-shadow: var(--shadow);
  text-align: center;
}

.login-shell {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(16, 28, 47, 0.96), rgba(16, 28, 47, 0.78) 42%, transparent 42%),
    linear-gradient(315deg, rgba(15, 118, 110, 0.12), transparent 34%),
    var(--bg);
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(390px, 450px);
  width: min(100%, 1080px);
  min-height: 640px;
  border: 1px solid rgba(217, 226, 236, 0.72);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.22);
  overflow: hidden;
}

.login-identity {
  display: grid;
  align-content: space-between;
  gap: 26px;
  min-height: 100%;
  background:
    linear-gradient(180deg, rgba(16, 28, 47, 0.94), rgba(16, 28, 47, 0.88)),
    var(--sidebar);
  color: #dbeafe;
  padding: clamp(28px, 5vw, 52px);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.login-brand strong,
.login-copy h1 {
  color: #fff;
}

.login-brand small,
.login-copy p {
  color: #b8c7dc;
}

.login-copy {
  display: grid;
  align-content: center;
  max-width: 560px;
  gap: 12px;
}

.login-copy h1 {
  font-size: clamp(2rem, 4vw, 3.4rem);
  max-width: 12ch;
}

.login-copy p:not(.eyebrow) {
  max-width: 56ch;
  margin: 0;
  line-height: 1.75;
}

.login-facts {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.login-facts span {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.07);
  color: #e2e8f0;
  padding: 8px 12px;
  font-size: 0.84rem;
  font-weight: 800;
}

.login-panel {
  display: grid;
  align-content: center;
  gap: 18px;
  width: 100%;
  background: rgba(255, 255, 255, 0.98);
  padding: clamp(24px, 4vw, 42px);
}

.login-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 4px;
}

.login-panel-head button {
  min-height: 34px;
  padding: 0 12px;
  color: var(--primary);
  font-weight: 800;
}

.login-submit {
  min-height: 46px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.18;
  color: var(--ink);
}

h1 {
  font-size: 1.9rem;
}

h2 {
  font-size: clamp(1.45rem, 2vw, 2rem);
}

h3 {
  font-size: 1rem;
}

.demo-users {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.88rem;
  padding-top: 10px;
}

.demo-users summary {
  cursor: pointer;
  font-weight: 800;
}

.demo-users > div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 10px;
}

.demo-users button {
  min-height: 30px;
  padding: 0 9px;
  font-size: 0.84rem;
}

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

.sidebar {
  position: sticky;
  top: 0;
  display: grid;
  grid-template-rows: auto 1fr auto;
  height: 100vh;
  background: var(--sidebar);
  color: #dbeafe;
  padding: 18px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.brand strong {
  color: #fff;
}

.brand-mark {
  display: grid;
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  place-items: center;
  border-radius: var(--radius);
  background: #16a39a;
  color: #fff;
  font-weight: 900;
}

.brand small {
  display: block;
  overflow: hidden;
  color: #a9b8ce;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav {
  display: grid;
  align-content: start;
  gap: 8px;
  padding-top: 18px;
}

.nav button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  border-color: transparent;
  background: transparent;
  color: #cbd5e1;
  padding: 10px 12px;
  text-align: start;
}

.nav button:hover {
  border-color: rgba(255, 255, 255, 0.08);
  background: var(--sidebar-2);
  box-shadow: none;
}

.nav button.active {
  border-color: rgba(20, 184, 166, 0.36);
  background: rgba(20, 184, 166, 0.15);
  color: #fff;
  font-weight: 800;
}

.nav-label {
  display: inline-flex;
  align-items: center;
  min-width: 0;
  gap: 10px;
}

.nav-label span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-arrow {
  display: inline-flex;
  opacity: 0.55;
}

.nav-arrow .icon {
  width: 15px;
  height: 15px;
}

[dir="rtl"] .nav-arrow .icon {
  transform: scaleX(-1);
}

.sidebar-actions {
  display: grid;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}

.sidebar-actions button {
  border-color: rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 20px;
}

.topbar-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  color: var(--muted);
  font-size: 0.9rem;
}

.topbar-meta span {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 7px 10px;
  box-shadow: var(--shadow-soft);
}

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

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

.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 66px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, #fff, var(--surface-2));
}

.panel-subtitle {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.84rem;
}

.panel-body {
  padding: 16px;
}

.span-3 {
  grid-column: span 3;
}

.span-4 {
  grid-column: span 4;
}

.span-5 {
  grid-column: span 5;
}

.span-6 {
  grid-column: span 6;
}

.span-7 {
  grid-column: span 7;
}

.span-12 {
  grid-column: span 12;
}

.metric {
  display: grid;
  gap: 8px;
  min-height: 124px;
  padding: 16px;
  border-top: 4px solid var(--primary);
}

.metric span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

.metric strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: clamp(1.55rem, 2.4vw, 2.15rem);
  line-height: 1.05;
}

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

.accent-teal {
  border-top-color: var(--primary);
}

.accent-blue {
  border-top-color: var(--blue);
}

.accent-amber {
  border-top-color: var(--accent);
}

.accent-green {
  border-top-color: var(--success);
}

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

.form-grid .wide {
  grid-column: 1 / -1;
}

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

.toolbar {
  display: grid;
  grid-template-columns: minmax(180px, 280px) minmax(150px, 210px) 40px;
  gap: 8px;
  align-items: center;
}

.search-field {
  position: relative;
  display: block;
}

.search-field .icon {
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 11px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}

.search-field input {
  padding-inline-start: 38px;
}

[dir="rtl"] .search-field input {
  padding-inline-start: 11px;
  padding-inline-end: 38px;
}

[dir="rtl"] .search-field .icon {
  inset-inline-start: auto;
  inset-inline-end: 11px;
}

.fee-box {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.fee-box div {
  min-height: 78px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 10px;
}

.fee-box span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.fee-box strong {
  display: block;
  margin-top: 8px;
  color: var(--ink);
  overflow-wrap: anywhere;
}

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

table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
  background: var(--surface);
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: start;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  color: var(--text);
  font-size: 0.92rem;
}

tr:hover td {
  background: #fbfdff;
}

.status {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--surface-3);
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  white-space: nowrap;
}

.status.good {
  background: #e7f7ed;
  color: var(--success);
}

.status.warn {
  background: #fff3d8;
  color: var(--warning);
}

.status.bad {
  background: #ffe9e7;
  color: var(--danger);
}

.status.info {
  background: #e7f3ff;
  color: var(--blue);
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

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

.row-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
  padding: 12px;
}

.status-mix {
  display: grid;
  gap: 12px;
}

.status-line {
  display: grid;
  gap: 8px;
}

.status-line > div:first-child {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.progress {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e5eaf1;
}

.progress span {
  display: block;
  height: 100%;
  min-width: 3px;
  border-radius: inherit;
  background: var(--primary);
}

.progress span.info,
.progress span.accent-blue {
  background: var(--blue);
}

.progress span.warn {
  background: var(--warning);
}

.progress span.bad {
  background: var(--danger);
}

.progress span.good {
  background: var(--success);
}

.credit-health {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 18px;
  align-items: center;
}

.credit-ring {
  display: grid;
  width: 132px;
  height: 132px;
  place-items: center;
  border-radius: 50%;
  background:
    radial-gradient(circle at center, #fff 0 58%, transparent 59%),
    conic-gradient(var(--primary) calc(var(--value) * 1%), #e5eaf1 0);
}

.credit-ring span {
  color: var(--ink);
  font-size: 1.4rem;
  font-weight: 900;
}

.credit-copy {
  display: grid;
  gap: 8px;
}

.credit-copy strong {
  color: var(--ink);
  font-size: 1.45rem;
}

.credit-copy small {
  color: var(--muted);
}

.credit-empty {
  display: grid;
  gap: 8px;
  padding: 10px;
}

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

.quick-action {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  min-height: 54px;
  padding: 12px;
  text-align: start;
  font-weight: 800;
}

.order-cards {
  display: none;
}

.order-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 14px;
}

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

.order-card-head > div {
  display: grid;
  gap: 4px;
}

.order-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.order-card dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.order-card dd {
  margin: 3px 0 0;
  color: var(--text);
  overflow-wrap: anywhere;
}

.order-card .wide {
  grid-column: 1 / -1;
}

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

@media (max-width: 1160px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-auto-rows: max-content;
    align-content: start;
  }

  .sidebar {
    position: sticky;
    z-index: 10;
    height: auto;
    min-height: 0;
    align-self: start;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto auto;
    align-items: center;
    gap: 12px;
    padding: 14px;
  }

  .brand {
    grid-column: 1;
    grid-row: 1;
    min-width: 0;
    padding-bottom: 12px;
    border-bottom: 0;
  }

  .nav {
    grid-column: 1 / -1;
    grid-row: 2;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-top: 0;
    padding-bottom: 2px;
  }

  .nav button {
    flex: 0 0 auto;
    width: auto;
    min-width: 132px;
  }

  .sidebar-actions {
    grid-column: 2;
    grid-row: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    border-top: 0;
    padding-top: 0;
  }

  .sidebar-actions button {
    min-width: 88px;
  }

  .topbar {
    display: grid;
  }

  .topbar-meta {
    justify-content: flex-start;
  }

  .workspace {
    align-self: start;
  }

  .span-3,
  .span-4,
  .span-5,
  .span-6,
  .span-7 {
    grid-column: span 12;
  }

  .toolbar {
    grid-template-columns: minmax(160px, 1fr) minmax(140px, 190px) 40px;
  }
}

@media (max-width: 760px) {
  body {
    overflow-x: hidden;
  }

  .app-shell {
    min-height: 100dvh;
  }

  .login-layout {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .login-identity {
    min-height: 260px;
    padding: 24px;
  }

  .login-copy h1 {
    max-width: 100%;
  }

  .workspace,
  .sidebar,
  .login-shell {
    padding: 14px;
  }

  .sidebar {
    top: 0;
    gap: 10px;
  }

  .brand {
    padding-bottom: 0;
  }

  .nav {
    margin-inline: -4px;
    padding-inline: 4px;
    scroll-padding-inline: 4px;
  }

  .nav button {
    min-width: max(118px, 36vw);
  }

  .workspace {
    padding-top: 16px;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 14px;
  }

  .topbar h2 {
    font-size: clamp(1.35rem, 8vw, 1.8rem);
  }

  .panel-header {
    display: grid;
    align-items: stretch;
    min-height: 0;
  }

  .panel-body {
    padding: 14px;
  }

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

  .toolbar {
    grid-template-columns: 1fr 1fr 40px;
  }

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

  .table-wrap {
    display: none;
  }

  .order-cards {
    display: grid;
    gap: 12px;
  }

  .credit-health {
    grid-template-columns: 1fr;
    justify-items: center;
    text-align: center;
  }

  .quick-actions {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  h1 {
    font-size: 1.55rem;
  }

  .login-shell {
    place-items: stretch;
  }

  .login-identity {
    min-height: 220px;
  }

  .login-copy p:not(.eyebrow),
  .login-facts {
    display: none;
  }

  .login-panel-head {
    align-items: center;
  }

  .sidebar {
    grid-template-columns: 1fr;
    position: relative;
  }

  .brand {
    grid-row: 1;
    justify-content: flex-start;
  }

  .sidebar-actions {
    grid-column: 1;
    grid-row: 2;
    width: 100%;
  }

  .nav {
    grid-row: 3;
  }

  .sidebar-actions button {
    flex: 1 1 0;
    min-width: 0;
  }

  .brand-mark {
    width: 40px;
    height: 40px;
    flex-basis: 40px;
  }

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

  .toolbar .icon-button {
    width: 100%;
    min-width: 100%;
  }

  .fee-box {
    grid-template-columns: 1fr;
  }

  .topbar-meta {
    display: grid;
    width: 100%;
  }

  .topbar-meta span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .order-card dl {
    grid-template-columns: 1fr;
  }
}
