:root {
  --bg: #f4f6f5;
  --surface: #ffffff;
  --surface-2: #eef3f0;
  --text: #14201b;
  --muted: #62706a;
  --line: #d8e0dc;
  --brand: #0d7c66;
  --brand-2: #f3bd2f;
  --danger: #c64242;
  --warning: #a66a00;
  --ok: #187c45;
  --shadow: 0 18px 48px rgba(22, 37, 31, 0.1);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(13, 124, 102, 0.08), transparent 260px),
    var(--bg);
}

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

button {
  cursor: pointer;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 0.95fr) minmax(360px, 1.05fr);
}

.brand-panel {
  min-height: 480px;
  padding: 48px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background:
    linear-gradient(rgba(8, 57, 48, 0.68), rgba(8, 57, 48, 0.68)),
    url("./assets/quokky-hero.png");
  background-size: auto 100%;
  background-position: right 58%;
  background-repeat: no-repeat;
  background-color: #12382f;
  color: white;
}

.brand-mark {
  display: flex;
  align-items: center;
  width: 154px;
  min-height: 54px;
}

.brand-logo {
  display: block;
  width: 154px;
  height: auto;
  filter: brightness(0) invert(1);
}

.brand-panel h1 {
  margin: 0 0 16px;
  max-width: 660px;
  font-size: clamp(38px, 5vw, 68px);
  line-height: 0.98;
  letter-spacing: 0;
}

.brand-panel p {
  max-width: 560px;
  margin: 0;
  font-size: 18px;
  line-height: 1.55;
  color: rgba(255, 255, 255, 0.82);
}

.login-main {
  display: grid;
  align-items: center;
  padding: 44px;
}

.login-card {
  width: min(100%, 520px);
  margin: 0 auto;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
}

.tabs {
  display: inline-grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  width: 100%;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
}

.tab {
  border: 0;
  border-radius: 6px;
  padding: 10px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
}

.tab.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 3px 12px rgba(20, 32, 27, 0.08);
}

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

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

.field span {
  font-size: 13px;
  color: var(--muted);
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

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

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(13, 124, 102, 0.12);
}

.btn {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 14px;
  background: var(--surface);
  color: var(--text);
  font-weight: 800;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn.primary {
  border-color: var(--brand);
  background: var(--brand);
  color: white;
}

.btn.warn {
  border-color: rgba(198, 66, 66, 0.24);
  color: var(--danger);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.demo-box {
  margin-top: 18px;
  padding: 14px;
  border-radius: 8px;
  background: #f7faf8;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 22px;
  background: #11231d;
  color: white;
}

.sidebar .brand-mark {
  width: 136px;
  min-height: 48px;
  margin-bottom: 24px;
}

.sidebar .brand-logo {
  width: 136px;
}

.nav {
  display: grid;
  gap: 8px;
}

.nav button {
  border: 0;
  border-radius: 8px;
  padding: 12px;
  background: transparent;
  color: rgba(255, 255, 255, 0.72);
  text-align: left;
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.nav button.active,
.nav button:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.sidebar-foot {
  margin-top: auto;
  display: grid;
  gap: 12px;
  color: rgba(255, 255, 255, 0.72);
}

.language-switcher {
  display: grid;
  gap: 6px;
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
}

.language-switcher span {
  font-size: 12px;
  font-weight: 800;
  color: rgba(255, 255, 255, 0.64);
}

.language-switcher select {
  min-height: 38px;
  border-color: rgba(255, 255, 255, 0.2);
  background: #17342b;
  color: white;
}

.user-chip {
  padding: 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.09);
}

.user-chip strong,
.user-chip span {
  display: block;
}

.user-chip span {
  margin-top: 4px;
  font-size: 12px;
  color: rgba(255, 255, 255, 0.64);
}

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

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

.topbar h2,
.login-card h2 {
  margin: 0;
  font-size: 28px;
  letter-spacing: 0;
}

.topbar p,
.login-card p {
  margin: 7px 0 0;
  color: var(--muted);
}

.actions {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}

.metric,
.panel,
.card,
.modal {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 8px 24px rgba(22, 37, 31, 0.06);
}

.metric {
  padding: 16px;
}

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

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
}

.layout-2 {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.7fr);
  gap: 16px;
}

.panel {
  padding: 16px;
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-head h3 {
  margin: 0;
  font-size: 18px;
}

.filters {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) repeat(3, minmax(140px, 190px));
  gap: 10px;
  margin-bottom: 14px;
}

.client-filters {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) repeat(4, minmax(138px, 176px));
  gap: 10px;
  margin-bottom: 12px;
}

.client-quickbar {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(220px, 1fr);
  gap: 14px;
  align-items: end;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.result-note {
  min-height: 42px;
  display: flex;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.4;
}

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

.orders-table table {
  min-width: 1160px;
}

.sales-filters {
  grid-template-columns: minmax(240px, 1fr) minmax(160px, 220px) minmax(150px, 190px);
}

.sales-board {
  display: grid;
  grid-template-columns: repeat(6, minmax(220px, 1fr));
  gap: 12px;
  overflow-x: auto;
  padding-bottom: 4px;
}

.sales-stage {
  min-width: 220px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbf9;
}

.sales-stage-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.sales-stage-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

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

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

.sales-card h4,
.sales-card p {
  margin: 0;
}

.sales-card strong {
  font-size: 20px;
}

.sales-card select {
  min-height: 36px;
}

.sales-next {
  padding: 10px;
  border-radius: 8px;
  background: var(--surface-2);
}

.sales-next span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.sales-next p {
  margin-top: 4px;
  font-size: 13px;
}

.empty.compact {
  padding: 18px 10px;
  font-size: 13px;
}

.table-actions {
  justify-content: flex-end;
  flex-wrap: nowrap;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

td {
  font-size: 14px;
}

.row-title {
  font-weight: 850;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 850;
  white-space: nowrap;
  background: var(--surface-2);
  color: var(--muted);
}

.badge.ok {
  background: rgba(24, 124, 69, 0.12);
  color: var(--ok);
}

.badge.warn {
  background: rgba(243, 189, 47, 0.2);
  color: var(--warning);
}

.badge.danger {
  background: rgba(198, 66, 66, 0.12);
  color: var(--danger);
}

.badge.info {
  background: rgba(13, 124, 102, 0.12);
  color: var(--brand);
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
}

.card {
  padding: 15px;
}

.card h3,
.card h4 {
  margin: 0 0 8px;
}

.kv {
  display: grid;
  gap: 8px;
  margin: 12px 0;
}

.kv div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.kv strong {
  color: var(--text);
  text-align: right;
}

.timeline {
  display: grid;
  gap: 11px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
  align-items: start;
}

.dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--brand);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(17, 35, 29, 0.42);
  z-index: 20;
}

.modal {
  width: min(720px, 100%);
  max-height: min(720px, 92vh);
  overflow: auto;
  padding: 20px;
}

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

.modal-head h3 {
  margin: 0;
  font-size: 22px;
}

.split-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.full {
  grid-column: 1 / -1;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  max-width: 360px;
  padding: 13px 15px;
  border-radius: 8px;
  background: #11231d;
  color: white;
  box-shadow: var(--shadow);
  z-index: 30;
}

.empty {
  padding: 30px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #fbfcfb;
}

.portal-hero {
  margin-bottom: 16px;
  padding: 22px;
  border-radius: 8px;
  color: white;
  background:
    linear-gradient(90deg, rgba(17, 35, 29, 0.92), rgba(13, 124, 102, 0.72)),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='900' height='360' viewBox='0 0 900 360'%3E%3Crect width='900' height='360' fill='%230d7c66'/%3E%3Cpath d='M0 250h900v70H0z' fill='%23f3bd2f'/%3E%3Cpath d='M470 155h214l54 95H432z' fill='%23ffffff' opacity='.9'/%3E%3Cpath d='M628 104h150c31 0 58 20 67 50l29 96H722z' fill='%23ffffff' opacity='.82'/%3E%3Ccircle cx='510' cy='268' r='34' fill='%2314201b'/%3E%3Ccircle cx='770' cy='268' r='34' fill='%2314201b'/%3E%3C/svg%3E");
  background-size: cover;
  background-position: center;
}

.portal-hero h2 {
  margin: 0 0 8px;
  font-size: 32px;
}

.portal-hero p {
  margin: 0;
  max-width: 720px;
  color: rgba(255, 255, 255, 0.8);
}

@media (max-width: 1080px) {
  .login-shell,
  .app-shell,
  .layout-2 {
    grid-template-columns: 1fr;
  }

  .brand-panel,
  .sidebar {
    position: static;
    height: auto;
  }

  .sidebar {
    padding: 16px;
  }

  .nav {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }

  .sidebar-foot {
    margin-top: 16px;
  }

  .metric-grid,
  .filters,
  .client-filters,
  .client-quickbar,
  .sales-filters {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  .brand-panel,
  .login-main,
  .main {
    padding: 18px;
  }

  .login-card {
    padding: 18px;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .metric-grid,
  .filters,
  .client-filters,
  .client-quickbar,
  .sales-filters,
  .split-form {
    grid-template-columns: 1fr;
  }

  table {
    min-width: 680px;
  }
}
