:root {
  --bg: #ffffff;
  --bg-2: #f3f6f9;
  --ink: #0d5784;
  --muted: #4b6b80;
  --brand: #0d5784;
  --brand-2: #0a4569;
  --accent: #80e75a;
  --card: #ffffff;
  --border: #e2e8f0;
  --shadow: 0 20px 60px rgba(15, 23, 42, 0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --input-h: 48px;
  --font-sans: "Space Grotesk", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
}

html, body {
  height: 100%;
}

body {
  margin: 0;
  font-family: var(--font-sans);
  color: var(--ink);
  background: radial-gradient(1200px 500px at 10% -10%, #e9f6ff, transparent 60%),
              radial-gradient(1200px 500px at 110% 10%, #f0fff2, transparent 60%),
              linear-gradient(180deg, var(--bg), var(--bg-2));
  overflow-x: hidden;
}

.topbar {
  background: var(--brand);
  color: var(--accent);
  height: 56px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 40;
}

.topbar * {
  color: var(--accent);
}

.page {
  min-height: 100%;
  display: grid;
  place-items: center;
  padding: 40px 20px;
}

.container {
  width: min(1100px, 100%);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.card-pad {
  padding: 32px;
}

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

.stat {
  background: white;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.split {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
}

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

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

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.brand-badge {
  width: 6rem;
  height: 5rem;
  border-radius: 12px;
  background: transparent;
  display: grid;
  place-items: center;
  color: var(--accent);
  font-weight: 700;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
}

.brand-logo img {
  width: 6rem;
  height: 5rem;
  object-fit: contain;
  display: block;
}

.h1 {
  font-size: clamp(28px, 2.8vw, 40px);
  margin: 16px 0 8px;
}

.h2 {
  font-size: clamp(20px, 2vw, 28px);
  margin: 0 0 8px;
  color: var(--accent);
}

.p {
  color: var(--muted);
  line-height: 1.6;
}

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

.label {
  font-size: 14px;
  color: var(--muted);
  margin-bottom: 6px;
}

.input {
  width: 100%;
  height: var(--input-h);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  padding: 0 14px;
  font-size: 15px;
  background: white;
}

.input-sm {
  height: 34px;
  font-size: 13px;
  padding: 0 10px;
}

.input:focus {
  outline: 2px solid rgba(14, 165, 168, 0.25);
  border-color: var(--brand);
}

.field {
  display: grid;
  gap: 6px;
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  min-width: 0;
}

.topbar .row {
  flex-wrap: nowrap;
}

.btn {
  height: var(--input-h);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  color: white;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.2s ease;
}

.btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 25px rgba(14, 165, 168, 0.2);
}

.btn-secondary {
  background: white;
  color: var(--ink);
  border: 1px solid var(--border);
}

.btn-accent {
  background: var(--accent);
  color: #0b3f5f;
  border: 1px solid rgba(13, 87, 132, 0.2);
}

.btn-danger {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.btn-sm {
  height: 36px;
  font-size: 13px;
  padding: 0 12px;
}

.btn:disabled,
.btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.link {
  color: var(--brand);
  text-decoration: none;
  font-weight: 600;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  padding: 6px 10px;
  background: rgba(13, 87, 132, 0.12);
  color: var(--brand);
  border-radius: 999px;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 999px;
  background: #e2e8f0;
  color: #0f172a;
}

.pill.warn {
  background: #ffedd5;
  color: #9a3412;
}

.pill.ok {
  background: #dcfce7;
  color: #166534;
}

.pill.info {
  background: rgba(13, 87, 132, 0.12);
  color: var(--brand);
}

.done-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #22c55e;
  color: #ffffff;
  font-size: 12px;
  font-weight: 700;
  margin-right: 6px;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  display: block;
  max-height: 60vh;
  overflow: auto;
  border-radius: 12px;
  overflow-x: auto;
}

.table-wide {
  min-width: 980px;
}

.table th {
  color: #0f172a;
}

.table td {
  color: #1f2937;
}

.table-wide th,
.table-wide td {
  white-space: nowrap;
}

.table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
  max-width: 100%;
}

.topbar-left {
  color: var(--accent);
}

.topbar-left .badge {
  color: var(--accent);
}

.table-wrap::-webkit-scrollbar {
  height: 8px;
}

.table-wrap::-webkit-scrollbar-thumb {
  background: rgba(13, 87, 132, 0.2);
  border-radius: 999px;
}

.table-wrap::-webkit-scrollbar-track {
  background: transparent;
}

.alert-bell {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: rgba(239, 68, 68, 0.15);
  color: #ffffff !important;
  text-decoration: none;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.alert-bell span {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #dc2626;
  color: white;
  font-size: 10px;
  border-radius: 999px;
  padding: 2px 6px;
}
.table-left th {
  text-align: left;
}

.table thead th {
  position: sticky;
  top: 0;
  background: white;
  z-index: 1;
}

.table {
  width: max-content;
  min-width: 100%;
  table-layout: auto;
}

.table-search {
  max-width: 320px;
}

.sort-icon {
  font-size: 11px;
  color: var(--muted);
  margin-left: 6px;
}

.app-layout {
  --sidebar-width: 220px;
  min-height: 100vh;
  height: 100vh;
  display: block;
  position: relative;
  background: #f8fafc;
  transition: none;
  max-width: 100%;
  overflow: hidden;
}

.layout.app-layout,
.app.app-layout {
  display: block !important;
  min-height: 100vh;
  height: 100vh;
}

.app-layout > main,
.app-layout > .content {
  margin-left: var(--sidebar-width);
  width: calc(100% - var(--sidebar-width));
  min-width: 0;
  min-height: 100vh;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: margin-left 0.2s ease, width 0.2s ease;
}

.content {
  overflow-x: hidden;
}

.app-layout .topbar {
  position: sticky;
  top: 0;
  z-index: 60;
}

.content > .topbar {
  margin: -20px -20px 20px;
  border-radius: 0;
}

.progress {
  height: 8px;
  background: #e5edf4;
  border-radius: 999px;
  overflow: hidden;
  width: 100%;
  min-width: 120px;
}

.progress > span {
  display: block;
  height: 100%;
  background: var(--accent);
  width: 0%;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

.modal.show {
  display: flex;
}

.modal-card {
  width: min(900px, 100%);
  background: white;
  border-radius: 16px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 20px;
  max-height: 80vh;
  overflow: auto;
}

.app-dialog-card {
  width: min(520px, 100%);
}

.app-dialog-title {
  margin-top: 0;
}

.app-dialog-message {
  margin: 0;
}

.app-dialog-input {
  margin-top: 12px;
}

.app-dialog-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: nowrap;
}

.sidebar-fixed {
  background: white;
  border-right: 1px solid var(--border);
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  overflow: auto;
  width: 220px;
  z-index: 70;
  transition: transform 0.2s ease, opacity 0.2s ease;
}

.app-layout.sidebar-hidden > main,
.app-layout.sidebar-hidden > .content {
  margin-left: 0;
  width: 100%;
}

.app-layout.sidebar-hidden .sidebar-fixed {
  transform: translateX(-100%);
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.topbar-left {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: transparent;
  color: var(--accent) !important;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.icon-btn span {
  font-size: 18px;
  line-height: 1;
}

.icon-btn .icon-close {
  display: inline;
}

.icon-btn .icon-open {
  display: none;
}

.app-layout.sidebar-hidden .icon-btn .icon-open {
  display: inline;
}

.app-layout.sidebar-hidden .icon-btn .icon-close {
  display: none;
}

.role-panel {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f9fafb;
}

.role-title {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.role-meta {
  font-size: 12px;
  color: var(--muted);
}

.role-chip {
  font-size: 12px;
  color: var(--accent);
  border: 1px dashed var(--border);
  padding: 6px 10px;
  border-radius: 999px;
}

.sidebar-footer {
  margin-top: auto;
}

.demo-overlay {
  position: fixed;
  inset: 0;
  background: rgba(17, 24, 39, 0.6);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 120;
  padding: 24px;
}

.demo-overlay.show {
  display: flex;
}

.demo-card {
  width: min(980px, 100%);
  background: white;
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  padding: 28px;
}

.demo-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.demo-body {
  display: grid;
  gap: 16px;
}

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

.demo-kpi {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px;
  background: #f7fbff;
  display: grid;
  gap: 6px;
}

.demo-kpi span {
  color: var(--muted);
  font-size: 13px;
}

.mini-grid {
  display: grid;
  gap: 10px;
}

.mini-kpi {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #f7fbff;
}

@media (max-width: 1460px) {
  .content {
    padding: 12px !important;
  }

  .table-wide {
    min-width: 680px;
  }

  .table {
    font-size: 12px;
  }

  .table th,
  .table td {
    padding: 6px 8px;
  }

  .order-actions .btn {
    height: 30px;
    font-size: 12px;
    padding: 0 8px;
  }

  .input-sm {
    height: 30px;
    font-size: 12px;
  }
}

@media (max-width: 1400px), (max-height: 500px) {
  .content {
    padding: 10px !important;
  }

  .table-wide {
    min-width: 600px;
  }
}

@media (max-height: 460px) {
  .content {
    padding: 8px !important;
  }

  .topbar {
    height: 46px;
    padding: 0 10px;
  }

  .h1 {
    margin: 6px 0 4px;
    font-size: clamp(18px, 2vw, 26px);
  }

  .card-pad {
    padding: 12px;
  }

  .table-wrap {
    max-height: 44vh;
  }

  .btn,
  .input {
    height: 40px;
  }
}

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

.tracker-timeline {
  display: flex;
  align-items: flex-start;
  overflow-x: auto;
  padding-bottom: 6px;
}

.tracker-step {
  position: relative;
  flex: 1 0 150px;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding-right: 18px;
}

.tracker-step .dot {
  width: 14px;
  height: 14px;
  border-radius: 999px;
  background: #cbd5e1;
  animation: none;
}

.tracker-step.active .dot {
  background: #22c55e;
}

.tracker-step .label {
  margin: 0;
  font-size: 12px;
  text-align: center;
  line-height: 1.3;
}

.tracker-step .bar {
  position: absolute;
  top: 6px;
  left: calc(50% + 10px);
  width: calc(100% - 20px);
  height: 3px;
  border-radius: 999px;
  background: #cbd5e1;
}

.tracker-step .bar.active {
  background: #22c55e;
}

.mini-kpi strong {
  font-size: 18px;
  color: var(--brand);
}

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

.message {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 14px;
  display: none;
}

.message.show {
  display: block;
}

.message.success {
  background: #dcfce7;
  color: #166534;
}

.message.error {
  background: #fee2e2;
  color: #991b1b;
}

.divider {
  height: 1px;
  background: var(--border);
  margin: 20px 0;
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: var(--muted);
}

.kbd {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #f8fafc;
}

.hero {
  padding: 36px;
  background: linear-gradient(160deg, #ecfeff, #fff7ed);
  border-radius: var(--radius);
  border: 1px solid #e5e7eb;
}

.hero ul {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 10px;
}

.hero li {
  display: flex;
  gap: 10px;
  color: var(--muted);
}

.fade-in {
  animation: fade-in 0.5s ease both;
}

.slide-up {
  animation: slide-up 0.6s ease both;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slide-up {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}
