:root {
  --ink: #17212b;
  --muted: #637083;
  --line: #d9e1ea;
  --panel: #ffffff;
  --soft: #f4f7fb;
  --brand: #116a7b;
  --brand-strong: #0b4c59;
  --gold: #b98424;
  --danger: #b42318;
  --ok: #19764a;
  --shadow: 0 10px 30px rgba(23, 33, 43, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  color: var(--ink);
  background: var(--soft);
  font-family: Arial, Helvetica, sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

.shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.brand strong {
  font-size: 18px;
  white-space: nowrap;
}

.brand span,
.mini {
  color: var(--muted);
  font-size: 12px;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: #ffffff;
  background: var(--brand);
  font-weight: 700;
}

.view {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.tabs {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  background: #ffffff;
  border-top: 1px solid var(--line);
}

.tab {
  min-height: 58px;
  display: grid;
  place-items: center;
  color: var(--muted);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}

.tab.active {
  color: var(--brand);
  box-shadow: inset 0 3px 0 var(--brand);
}

.grid {
  display: grid;
  grid-template-columns: 1.1fr 0.9fr;
  gap: 18px;
}

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

.panel-head {
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

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

.panel-body {
  padding: 16px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

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

label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

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

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

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(17, 106, 123, 0.18);
  border-color: var(--brand);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  min-height: 42px;
  padding: 10px 14px;
  border-radius: 7px;
  background: var(--brand);
  color: #ffffff;
  font-weight: 700;
}

.btn.secondary {
  color: var(--brand);
  background: #e8f3f5;
}

.btn.ghost {
  color: var(--ink);
  background: #eef2f6;
}

.btn.danger {
  background: var(--danger);
}

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

.metric {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfe;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.metric strong {
  display: block;
  margin-top: 4px;
  font-size: 20px;
}

.paybox {
  margin-top: 14px;
  padding: 14px;
  border-radius: 8px;
  color: #ffffff;
  background: var(--brand-strong);
}

.paybox small {
  display: block;
  margin-top: 4px;
  opacity: 0.8;
}

.chat-list,
.sale-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-compose {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 14px;
}

.message {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.message-body {
  min-width: 0;
}

.message-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
}

.message p {
  margin: 7px 0 0;
  line-height: 1.45;
}

.sale-row {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.sale-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.sale-title strong {
  display: block;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 5px 8px;
  border-radius: 999px;
  color: var(--brand);
  background: #e8f3f5;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.line-items {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.line-items div {
  padding: 8px;
  border-radius: 7px;
  background: #f5f7fa;
  font-size: 12px;
}

.line-items b {
  display: block;
  margin-top: 3px;
  font-size: 14px;
}

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

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: min(420px, 100%);
  padding: 22px;
}

.login-card h1 {
  margin: 0 0 8px;
  font-size: 25px;
}

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

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: end;
  justify-content: space-between;
  margin-bottom: 14px;
}

.toolbar .field {
  min-width: 190px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 74px;
  z-index: 40;
  transform: translateX(-50%);
  padding: 10px 14px;
  border-radius: 999px;
  color: #ffffff;
  background: var(--ink);
  box-shadow: var(--shadow);
}

.hidden {
  display: none;
}

@media (max-width: 820px) {
  .topbar {
    padding: 12px;
  }

  .view {
    padding: 12px;
  }

  .grid,
  .form-grid,
  .chat-compose,
  .summary-strip,
  .line-items {
    grid-template-columns: 1fr;
  }

  .brand strong {
    font-size: 16px;
  }

  .user-chip span {
    display: none;
  }
}
