:root {
  --ink: #111820;
  --nav: #12191f;
  --blue: #0b8fc6;
  --blue-dark: #07698f;
  --blue-pale: #d6eaf5;
  --paper: #ffffff;
  --canvas: #eef1f3;
  --line: #c7d0d6;
  --muted: #687681;
  --danger: #b83c32;
  --success: #257653;
}

* {
  box-sizing: border-box;
}

html {
  background: var(--canvas);
}

body {
  min-width: 320px;
  margin: 0;
  background: var(--canvas);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  -webkit-font-smoothing: antialiased;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid #aebbc3;
  border-radius: 1px;
  padding: 0 11px;
  color: var(--ink);
  background: #fff;
  outline: none;
}

input:focus,
select:focus {
  border-color: var(--blue);
  box-shadow: inset 3px 0 var(--blue);
}

label {
  display: grid;
  gap: 6px;
  color: #44515a;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.06em;
}

.button {
  min-height: 44px;
  border: 1px solid var(--blue);
  border-radius: 1px;
  padding: 0 16px;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.button.primary {
  color: #fff;
  background: var(--blue);
}

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

.button.secondary {
  color: var(--ink);
  border-color: #b8c3ca;
  background: #fff;
}

.button.compact {
  min-height: 38px;
}

.section-kicker {
  display: block;
  color: var(--blue-dark);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.14em;
}

.app-loading,
.app-error {
  display: grid;
  min-height: 100vh;
  place-content: center;
  gap: 8px;
  text-align: center;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: 244px;
  flex-direction: column;
  padding: 24px 17px 18px;
  color: #fff;
  background:
    linear-gradient(145deg, rgba(11, 143, 198, 0.16), transparent 35%),
    var(--nav);
  border-right: 3px solid #1e2a32;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 7px 28px;
}

.brand img {
  width: 64px;
  height: 42px;
  object-fit: contain;
}

.brand div {
  display: grid;
  gap: 3px;
}

.brand strong {
  font-size: 17px;
  letter-spacing: 0.13em;
}

.brand span {
  color: #8fa1ad;
  font-size: 9px;
  letter-spacing: 0.12em;
}

.sidebar nav {
  display: grid;
  gap: 5px;
}

.nav-item {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 10px;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  padding: 0 12px;
  color: #aab6be;
  background: transparent;
  text-align: left;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.04em;
}

.nav-item span {
  display: grid;
  width: 24px;
  height: 24px;
  place-items: center;
  border: 1px solid #52606a;
  color: #bbdce9;
}

.nav-item:hover,
.nav-item.active {
  color: #fff;
  border-left-color: var(--blue);
  background: #1b252c;
}

.sidebar-info {
  display: grid;
  gap: 5px;
  margin-top: auto;
  border-top: 1px solid #34414a;
  padding: 16px 8px 0;
}

.sidebar-info strong {
  font-size: 11px;
}

.sidebar-info span {
  color: #84949f;
  font-size: 9px;
  text-transform: uppercase;
}

.sidebar-info a {
  width: max-content;
  margin-top: 8px;
  color: #9bd8ed;
  font-size: 9px;
  font-weight: 900;
  text-decoration: none;
}

.main {
  min-height: 100vh;
  margin-left: 244px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-height: 66px;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 0 28px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.topbar > div {
  display: grid;
  gap: 2px;
  text-align: right;
}

.topbar span {
  color: var(--muted);
  font-size: 8px;
  letter-spacing: 0.08em;
}

.topbar strong {
  font-size: 12px;
}

.topbar > b {
  border-left: 3px solid var(--blue);
  padding: 8px 10px;
  color: var(--blue-dark);
  background: var(--blue-pale);
  font-size: 9px;
  text-transform: uppercase;
}

.mobile-menu {
  display: none;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 18px;
  width: min(1580px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.catalog {
  min-width: 0;
}

.page,
.catalog {
  padding-bottom: 70px;
}

.page {
  width: min(1280px, calc(100% - 48px));
  margin: 0 auto;
  padding-top: 28px;
}

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

.page-heading h1 {
  margin: 5px 0 0;
  font-size: clamp(27px, 3vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.035em;
}

.page-heading p {
  max-width: 650px;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.source-box {
  display: grid;
  min-width: 215px;
  gap: 5px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  padding: 11px 13px;
  background: #fff;
}

.source-box span {
  color: var(--muted);
  font-size: 8px;
  font-weight: 900;
}

.source-box strong {
  max-width: 260px;
  overflow: hidden;
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel,
.data-panel {
  border: 1px solid var(--line);
  border-radius: 1px;
  background: #fff;
  box-shadow: 0 8px 24px rgba(20, 38, 49, 0.06);
}

.customer-panel {
  padding: 17px;
}

.panel-title {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 15px;
}

.panel-title span {
  display: grid;
  width: 31px;
  height: 31px;
  place-items: center;
  color: #fff;
  background: var(--ink);
  font-size: 10px;
  font-weight: 900;
}

.panel-title h2 {
  margin: 0;
  font-size: 15px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.field-grid.compact input,
.field-grid.compact select {
  min-height: 37px;
}

.mode-tabs,
.category-row,
.table-tabs {
  display: flex;
  gap: 5px;
  margin-top: 13px;
  overflow-x: auto;
}

.mode-tabs button,
.category-row button,
.table-tabs button {
  flex: 0 0 auto;
  min-height: 35px;
  border: 1px solid #b9c4cb;
  border-radius: 1px;
  padding: 0 12px;
  color: #47545d;
  background: #f8f9fa;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.mode-tabs button.active,
.category-row button.active,
.table-tabs button.active {
  color: #fff;
  border-color: var(--ink);
  background: var(--ink);
}

.products {
  margin-top: 24px;
}

.products-heading {
  justify-content: space-between;
}

.products-heading > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.products-heading b {
  color: var(--muted);
  font-size: 9px;
}

.search-row input {
  min-height: 44px;
  border-left: 4px solid var(--blue);
}

.category-row {
  margin: 8px 0 10px;
}

.product-list {
  display: grid;
  gap: 7px;
}

.product-row {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 120px 106px;
  min-height: 118px;
  align-items: center;
  border: 1px solid var(--line);
  border-left: 4px solid transparent;
  background: #fff;
}

.product-row.selected {
  border-left-color: var(--blue);
  background: #fbfdfe;
}

.product-image {
  display: grid;
  height: 100%;
  place-items: center;
  border-right: 1px solid #e1e6e9;
  background: #fafbfb;
}

.product-image img {
  width: 94px;
  height: 92px;
  object-fit: contain;
}

.product-image span {
  color: var(--blue-dark);
  font-size: 10px;
  font-weight: 900;
}

.product-main {
  min-width: 0;
  padding: 14px 16px;
}

.product-main small {
  color: var(--blue-dark);
  font-size: 8px;
  font-weight: 900;
  text-transform: uppercase;
}

.product-main h3 {
  margin: 5px 0;
  font-size: 15px;
}

.product-main p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
}

.product-price {
  display: grid;
  gap: 5px;
  padding: 12px;
  text-align: right;
}

.product-price strong {
  font-size: 12px;
}

.product-price span {
  color: var(--muted);
  font-size: 9px;
}

.quantity {
  display: grid;
  grid-template-columns: 33px 35px 33px;
  margin-right: 12px;
  border: 1px solid #aebbc3;
}

.quantity button {
  width: 33px;
  height: 38px;
  border: 0;
  border-radius: 0;
  color: var(--blue-dark);
  background: #edf5f8;
  font-size: 17px;
  font-weight: 900;
}

.quantity b {
  display: grid;
  place-items: center;
  font-size: 11px;
}

.quote {
  position: sticky;
  top: 83px;
  align-self: start;
  max-height: calc(100vh - 104px);
  overflow-y: auto;
  border: 1px solid #aeb9c0;
  border-top: 4px solid var(--ink);
  background: #fff;
  box-shadow: 0 14px 34px rgba(17, 32, 42, 0.1);
}

.quote-title,
.quote-client,
.quote-lines,
.extra-grid,
.totals,
.payment-box,
.notes,
.actions {
  margin-inline: 16px;
}

.quote-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 0 12px;
  border-bottom: 2px solid var(--ink);
}

.quote-title h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.quote-title > b {
  padding: 6px 8px;
  color: #fff;
  background: var(--ink);
  font-size: 8px;
  text-transform: uppercase;
}

.quote-client {
  display: grid;
  gap: 3px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.quote-client strong {
  font-size: 11px;
}

.quote-client span {
  color: var(--muted);
  font-size: 9px;
}

.quote-lines {
  max-height: 210px;
  overflow-y: auto;
}

.quote-lines > div {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid #e6ebee;
}

.quote-lines span {
  display: grid;
  gap: 3px;
}

.quote-lines strong,
.quote-lines b {
  font-size: 9px;
}

.quote-lines small {
  color: var(--muted);
  font-size: 8px;
}

.quote-lines .empty {
  display: grid;
  justify-content: center;
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.extra-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 11px 0;
  border-bottom: 1px solid var(--line);
}

.extra-grid input {
  min-height: 36px;
}

.totals {
  display: grid;
  gap: 7px;
  padding: 11px 0;
}

.totals > div {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 9px;
}

.totals b {
  color: var(--ink);
}

.totals .grand {
  align-items: center;
  margin-top: 2px;
  padding: 11px;
  color: #fff;
  background: var(--ink);
}

.grand b {
  color: #fff;
  font-size: 17px;
}

.payment-box {
  border: 1px solid #b7c6cf;
  padding: 11px;
  background: #f2f7f9;
}

.payment-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
  font-size: 9px;
}

.payment-title span {
  color: var(--muted);
  font-size: 7px;
}

.payment-values {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  margin-top: 10px;
}

.payment-values span {
  display: grid;
  gap: 3px;
  color: var(--muted);
  font-size: 7px;
}

.payment-values b {
  color: var(--ink);
  font-size: 10px;
}

.payment-values > strong {
  grid-column: 1 / -1;
  border-top: 1px solid #cad7de;
  padding-top: 8px;
  color: var(--blue-dark);
  font-size: 16px;
}

.notes {
  display: grid;
  gap: 3px;
  padding: 9px 0;
  color: var(--muted);
  font-size: 7px;
  line-height: 1.35;
}

.actions {
  display: grid;
  gap: 6px;
  padding-bottom: 16px;
}

.actions > div {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}

.inline-error,
.form-message {
  margin: 0;
  color: var(--danger);
  font-size: 9px;
  text-align: center;
}

.mobile-summary {
  display: none;
}

.data-panel {
  overflow: hidden;
}

.table-tabs {
  margin-bottom: 9px;
}

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

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 10px;
}

th {
  padding: 11px 13px;
  color: #fff;
  background: var(--ink);
  text-align: left;
  font-size: 8px;
  letter-spacing: 0.04em;
}

td {
  padding: 11px 13px;
  border-bottom: 1px solid #dfe5e8;
  vertical-align: top;
}

td span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 8px;
}

.empty-page {
  padding: 48px;
  color: var(--muted);
  text-align: center;
}

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

.user-create {
  display: grid;
  align-content: start;
  gap: 12px;
  padding: 18px;
}

.user-create h2 {
  margin: 0 0 4px;
  font-size: 14px;
}

.user-list {
  align-self: start;
}

.user-row {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) 170px auto auto;
  align-items: center;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid #dfe5e8;
}

.user-row > div {
  display: grid;
  gap: 3px;
}

.user-row span {
  color: var(--muted);
  font-size: 9px;
}

.user-row select {
  min-height: 36px;
}

.text-button {
  min-height: 32px;
  border: 0;
  border-bottom: 2px solid var(--blue);
  color: var(--blue-dark);
  background: transparent;
  font-size: 8px;
  font-weight: 900;
}

.text-button.danger {
  color: var(--danger);
  border-color: var(--danger);
}

.auth-body {
  min-height: 100vh;
  background:
    linear-gradient(110deg, rgba(11, 143, 198, 0.1), transparent 36%),
    #0f161b;
}

.login-shell,
.setup-shell {
  display: grid;
  width: min(980px, calc(100% - 32px));
  min-height: 590px;
  margin: 5vh auto;
  grid-template-columns: 1.15fr 0.85fr;
  border: 1px solid #34434c;
  background: #fff;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.34);
}

.login-intro,
.setup-brand {
  padding: 56px;
  color: #fff;
  background:
    linear-gradient(155deg, rgba(11, 143, 198, 0.24), transparent 45%),
    #151e24;
}

.login-intro img,
.setup-brand img {
  width: 180px;
  height: 88px;
  margin-bottom: 42px;
  object-fit: contain;
}

.login-intro > span,
.setup-brand > span {
  color: #80cde9;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.16em;
}

.login-intro h1,
.setup-brand h1 {
  margin: 9px 0 12px;
  font-size: 40px;
  line-height: 1;
  letter-spacing: -0.04em;
}

.login-intro > p,
.setup-brand > p {
  max-width: 430px;
  margin: 0;
  color: #a9b6be;
  font-size: 13px;
  line-height: 1.55;
}

.role-list {
  display: grid;
  gap: 0;
  margin-top: 36px;
  border-top: 1px solid #3a464e;
}

.role-list > div {
  display: grid;
  gap: 3px;
  border-bottom: 1px solid #3a464e;
  padding: 11px 0;
}

.role-list strong {
  font-size: 10px;
  text-transform: uppercase;
}

.role-list span {
  color: #87969f;
  font-size: 9px;
}

.login-form,
.setup-form {
  display: grid;
  align-content: center;
  gap: 14px;
  padding: 52px;
}

.login-form h2,
.setup-form h2 {
  margin: 0 0 7px;
  font-size: 24px;
  letter-spacing: -0.03em;
}

.login-form small {
  color: var(--muted);
  font-size: 9px;
  text-align: center;
}

.auth-error,
.auth-success {
  border-left: 4px solid var(--danger);
  padding: 10px;
  color: #732a24;
  background: #f9e7e5;
  font-size: 10px;
}

.auth-success {
  color: #1d6344;
  border-color: var(--success);
  background: #e7f4ed;
}

.setup-shell {
  width: min(1120px, calc(100% - 32px));
  grid-template-columns: 0.8fr 1.2fr;
}

.setup-form {
  align-content: start;
  padding: 40px;
}

.setup-form h2 {
  border-bottom: 2px solid var(--ink);
  padding-bottom: 8px;
  font-size: 17px;
}

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

.span-2 {
  grid-column: 1 / -1;
}

@media (max-width: 1120px) {
  .workspace {
    grid-template-columns: minmax(0, 1fr) 350px;
    padding: 18px;
  }

  .product-row {
    grid-template-columns: 96px minmax(0, 1fr) 105px;
  }

  .quantity {
    grid-column: 2 / 4;
    justify-self: end;
    margin: 0 12px 10px;
  }
}

@media (max-width: 880px) {
  .sidebar {
    inset: 65px auto 0 0;
    transform: translateX(-100%);
    transition: transform 160ms ease;
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .main {
    margin-left: 0;
  }

  .topbar {
    justify-content: space-between;
    padding: 0 14px;
  }

  .topbar > div {
    margin-left: auto;
  }

  .mobile-menu {
    display: block;
    min-height: 34px;
    border: 1px solid var(--ink);
    border-radius: 0;
    color: var(--ink);
    background: #fff;
    font-size: 9px;
    font-weight: 900;
  }

  .workspace {
    display: block;
    padding: 14px;
  }

  .quote {
    position: static;
    max-height: none;
    margin-top: 20px;
  }

  .mobile-summary {
    position: sticky;
    bottom: 0;
    z-index: 18;
    display: grid;
    width: 100%;
    min-height: 58px;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 12px;
    border: 0;
    border-top: 3px solid var(--blue);
    border-radius: 0;
    padding: 0 14px;
    color: #fff;
    background: var(--ink);
    text-align: left;
  }

  .mobile-summary span,
  .mobile-summary em {
    font-size: 8px;
    font-style: normal;
    font-weight: 900;
  }

  .mobile-summary b {
    font-size: 14px;
  }

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

  .user-row {
    grid-template-columns: 1fr 160px;
  }

  .login-shell,
  .setup-shell {
    grid-template-columns: 1fr;
    margin: 16px auto;
  }

  .login-intro,
  .setup-brand {
    padding: 34px;
  }

  .login-intro img,
  .setup-brand img {
    margin-bottom: 26px;
  }

  .login-form,
  .setup-form {
    padding: 34px;
  }
}

@media (max-width: 620px) {
  .page {
    width: calc(100% - 28px);
    padding-top: 18px;
  }

  .page-heading {
    display: grid;
  }

  .source-box {
    min-width: 0;
  }

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

  .span-2 {
    grid-column: auto;
  }

  .product-row {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .product-price {
    grid-column: 1;
    padding: 8px;
    text-align: center;
  }

  .quantity {
    grid-column: 2;
  }

  .topbar > b {
    display: none;
  }

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

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

  .login-intro,
  .setup-brand,
  .login-form,
  .setup-form {
    padding: 26px;
  }

  .login-intro h1,
  .setup-brand h1 {
    font-size: 33px;
  }
}
