:root {
  color-scheme: light;
  --bg: #f5f5f7;
  --panel: rgba(255, 255, 255, 0.78);
  --panel-strong: #ffffff;
  --text: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.1);
  --line-strong: rgba(0, 0, 0, 0.18);
  --accent: #0071e3;
  --accent-strong: #005bbd;
  --danger: #c9362b;
  --shadow: 0 24px 70px rgba(20, 20, 30, 0.12);
  --radius: 8px;
  --control: rgba(255, 255, 255, 0.92);
  --warm: #c28f66;
  --warm-soft: #f4eadf;
  --success: #12805c;
  --warning: #b7791f;
}

[data-theme="dark"] {
  color-scheme: dark;
  --bg: #09090b;
  --panel: rgba(28, 28, 30, 0.78);
  --panel-strong: #1c1c1e;
  --text: #f5f5f7;
  --muted: #a1a1a6;
  --line: rgba(255, 255, 255, 0.12);
  --line-strong: rgba(255, 255, 255, 0.2);
  --accent: #0a84ff;
  --accent-strong: #409cff;
  --danger: #ff5a52;
  --shadow: 0 24px 70px rgba(0, 0, 0, 0.42);
  --control: rgba(44, 44, 46, 0.96);
  --warm-soft: rgba(194, 143, 102, 0.14);
  --success: #42d392;
  --warning: #f2b84b;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 24% 4%, rgba(0, 113, 227, 0.12), transparent 28rem),
    linear-gradient(135deg, var(--bg), color-mix(in srgb, var(--bg), #ffffff 12%));
  color: var(--text);
}

body.auth-locked {
  overflow: hidden;
}

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

button {
  cursor: pointer;
}

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

.app-view {
  display: none;
}

.app-view.is-active {
  display: grid;
}

.hub-view {
  min-height: 100vh;
  padding: 34px;
  align-content: start;
  gap: 26px;
}

.hub-header,
.returns-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
}

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 1000;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 16%, rgba(194, 143, 102, 0.2), transparent 30rem),
    color-mix(in srgb, var(--bg), #000000 4%);
  display: grid;
  place-items: center;
}

.auth-card {
  width: min(430px, 100%);
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
  display: grid;
  gap: 16px;
}

.auth-brand {
  margin-bottom: 4px;
}

.auth-brand h1 {
  font-size: 34px;
}

.auth-status {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.auth-status.is-error {
  color: var(--danger);
}

.session-pill {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  font-size: 12px;
  font-weight: 800;
}

.hub-brand .brand-mark {
  width: 68px;
  height: 68px;
}

.hub-brand h1 {
  font-size: 40px;
}

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

.global-search-panel,
.todo-panel,
.hub-links-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 16px 44px rgba(20, 20, 30, 0.08);
  backdrop-filter: blur(24px);
}

.global-search-panel {
  grid-template-columns: minmax(220px, 0.45fr) minmax(300px, 1fr);
  align-items: start;
  position: relative;
}

.hub-dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(440px, 0.95fr);
  gap: 16px;
  align-items: start;
}

.hub-links-panel {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  overflow: visible;
}

.hub-link-group {
  display: grid;
  align-content: start;
  gap: 7px;
}

.hub-link-group:first-child {
  grid-column: 1 / -1;
}

.tool-links {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 7px;
}

.hub-tool-link {
  --link-color: var(--accent);
  min-height: 30px;
  padding: 0 8px;
  border: 1px solid color-mix(in srgb, var(--link-color), var(--line) 42%);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--control), var(--link-color) 10%);
  color: var(--text);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 800;
  text-decoration: none;
  transition: transform 0.16s ease, border-color 0.16s ease, background 0.16s ease;
}

.hub-link-group:first-child .hub-tool-link {
  min-height: 32px;
  padding: 0 9px;
}

.hub-tool-link span {
  width: 19px;
  height: 19px;
  display: inline-grid;
  place-items: center;
  border-radius: 7px;
  background: color-mix(in srgb, var(--link-color), transparent 82%);
  color: var(--link-color);
  font-weight: 900;
}

.hub-tool-link:hover {
  border-color: var(--link-color);
  background: color-mix(in srgb, var(--control), var(--link-color) 17%);
  transform: translateY(-1px);
}

.link-mail { --link-color: #0f766e; }
.link-shoper { --link-color: #2563eb; }
.link-furgonetka { --link-color: #7c3aed; }
.link-inpost-pay { --link-color: #d97706; }
.link-instagram { --link-color: #d62976; }
.link-facebook { --link-color: #1877f2; }
.link-meta { --link-color: #0866ff; }
.link-meta-call { --link-color: #16a34a; }
.link-tiktok { --link-color: #e11d48; }
.link-analytics { --link-color: #f59e0b; }
.link-apaczka { --link-color: #9333ea; }
.link-inpost-track { --link-color: #ca8a04; }
.link-inpost-code { --link-color: #84cc16; }
.link-receipts { --link-color: #c2410c; }
.link-przelewy24 { --link-color: #1d4ed8; }
.link-payment-link { --link-color: #0284c7; }
.link-paypo { --link-color: #be123c; }
.link-infakt { --link-color: #65a30d; }
.link-edrone { --link-color: #0891b2; }
.link-trustmate { --link-color: #f97316; }
.link-tally { --link-color: #475569; }
.link-canva { --link-color: #06b6d4; }
.link-courses { --link-color: #4f46e5; }
.link-chatgpt { --link-color: #10a37f; }
.link-gemini { --link-color: #8b5cf6; }
.link-image-gen { --link-color: #db2777; }
.link-openai-billing { --link-color: #059669; }

.hub-search-box {
  display: grid;
  grid-template-columns: 28px 1fr;
  align-items: center;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
}

.hub-search-box span {
  color: var(--muted);
  font-size: 20px;
}

.hub-search-box input {
  min-height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.global-search-results {
  grid-column: 2;
  display: grid;
  gap: 8px;
  max-height: 240px;
  overflow: auto;
}

.global-search-results button {
  min-height: 48px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
  color: var(--text);
  display: grid;
  gap: 3px;
  text-align: left;
}

.global-search-results button span,
.empty-mini {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.todo-panel {
  align-content: start;
}

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

.todo-form {
  display: grid;
  grid-template-columns: 1fr 96px 140px 110px auto;
  gap: 8px;
}

.todo-list {
  display: grid;
  gap: 8px;
  max-height: 360px;
  overflow: auto;
}

.todo-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
  min-width: 0;
}

.todo-item.is-done {
  opacity: 0.62;
}

.todo-check {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 800;
  min-width: 0;
  flex: 1 1 auto;
}

.todo-check input {
  width: 18px;
  min-width: 18px;
  min-height: 18px;
  accent-color: var(--accent);
}

.todo-check span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.todo-item.is-done .todo-check span {
  text-decoration: line-through;
}

.todo-meta {
  display: flex;
  flex: 0 0 auto;
  flex-wrap: nowrap;
  gap: 6px;
}

.todo-meta span {
  padding: 5px 8px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--control), var(--text) 6%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.todo-meta .owner.basia {
  color: #d62976;
  background: color-mix(in srgb, #d62976, transparent 86%);
}

.todo-meta .owner.bartek {
  color: #2563eb;
  background: color-mix(in srgb, #2563eb, transparent 86%);
}

.priority.high {
  color: var(--danger);
}

.priority.medium {
  color: var(--warning);
}

.priority.low {
  color: var(--success);
}

.module-search-panel {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}

.hub-card {
  min-height: 150px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
  display: grid;
  align-content: start;
  gap: 14px;
  text-align: left;
}

.hub-card.featured {
  border-color: color-mix(in srgb, var(--warm), var(--line) 20%);
  background: linear-gradient(135deg, var(--panel), var(--warm-soft));
}

.hub-card.disabled {
  opacity: 0.62;
}

.hub-card-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: color-mix(in srgb, var(--control), var(--warm) 18%);
  border: 1px solid color-mix(in srgb, var(--line), var(--warm) 36%);
  font-size: 22px;
  font-weight: 800;
}

.hub-card strong {
  font-size: 21px;
  line-height: 1.08;
}

.hub-card span:last-child {
  color: var(--muted);
  line-height: 1.45;
}

.users-admin-panel {
  display: grid;
  gap: 18px;
}

.users-create-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) auto;
  gap: 12px;
  align-items: end;
}

.users-table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

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

.users-table th,
.users-table td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

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

.users-table tr:last-child td {
  border-bottom: 0;
}

.status-badge {
  display: inline-grid;
  min-height: 28px;
  padding: 5px 9px;
  place-items: center;
  border: 1px solid color-mix(in srgb, var(--accent), var(--line) 45%);
  border-radius: 999px;
  background: color-mix(in srgb, var(--control), var(--accent) 12%);
  color: var(--text);
  font-size: 12px;
  font-weight: 800;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 28px;
  border-right: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(24px);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

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

.brand[data-open-view] {
  cursor: pointer;
}

.brand-mark {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #f6ecd9;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.22);
}

.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: 28px;
  line-height: 1;
  letter-spacing: 0;
}

h2 {
  font-size: 30px;
  letter-spacing: 0;
}

h3 {
  font-size: 24px;
  letter-spacing: 0;
}

.eyebrow,
.field-label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.sidebar-section {
  display: grid;
  gap: 8px;
}

.search-box {
  display: grid;
  grid-template-columns: 26px 1fr;
  align-items: center;
  min-height: 44px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
}

.search-box span {
  color: var(--muted);
  font-size: 21px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
  color: var(--text);
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
  appearance: none;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea {
  min-height: 110px;
  padding: 11px 12px;
  resize: vertical;
}

.search-box input {
  min-height: 42px;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

input:focus,
select:focus,
textarea:focus,
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent), transparent 82%);
}

.search-box input:focus {
  box-shadow: none;
  border: 0;
}

.search-box input::-webkit-search-decoration,
.search-box input::-webkit-search-cancel-button {
  appearance: none;
}

.sidebar-actions {
  display: grid;
  gap: 10px;
  margin-top: auto;
}

.primary-button,
.ghost-button,
.danger-button,
.text-button,
.icon-button {
  border: 0;
  border-radius: var(--radius);
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 700;
  transition: transform 0.16s ease, background 0.16s ease, opacity 0.16s ease;
}

.primary-button {
  background: var(--accent);
  color: white;
}

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

.ghost-button,
.icon-button {
  background: color-mix(in srgb, var(--control), var(--text) 4%);
  color: var(--text);
  border: 1px solid var(--line);
}

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

.text-button {
  min-height: 36px;
  padding: 0 10px;
  background: transparent;
  color: var(--accent);
}

.compact {
  min-height: 38px;
  padding: 0 16px;
}

.icon-button {
  width: 38px;
  height: 38px;
  min-height: 38px;
  font-size: 24px;
}

button:hover {
  transform: translateY(-1px);
}

.workspace {
  min-width: 0;
  padding: 30px;
  display: grid;
  grid-template-rows: auto auto minmax(0, 1fr);
  gap: 18px;
}

.returns-view {
  min-height: 100vh;
  padding: 30px;
  gap: 18px;
  align-content: start;
}

.month-picker-panel,
.seller-card,
.returns-summary,
.calculation-card,
.statistics-panel,
.stats-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 16px 44px rgba(20, 20, 30, 0.08);
  backdrop-filter: blur(22px);
}

.month-picker-panel {
  padding: 20px;
  display: grid;
  gap: 18px;
}

.panel-title-row,
.ledger-actions-row,
.items-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
}

.month-create {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) 110px auto;
  gap: 10px;
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 12px;
}

.month-card {
  padding: 16px;
  min-height: 128px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
  color: var(--text);
  display: grid;
  gap: 10px;
  text-align: left;
}

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

.month-card span {
  color: var(--muted);
}

.returns-ledger {
  display: grid;
  gap: 14px;
}

.seller-card {
  padding: 18px;
}

.seller-grid {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(220px, 1fr) minmax(130px, 0.7fr) minmax(170px, 0.8fr) 100px;
  gap: 12px;
}

.seller-grid label,
.return-form-body label {
  display: grid;
  gap: 8px;
}

.returns-summary {
  padding: 16px;
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}

.summary-tile {
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
  display: grid;
  gap: 5px;
}

.summary-tile span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.summary-tile strong {
  font-size: 22px;
}

.returns-table-wrap {
  height: calc(100vh - 360px);
  min-height: 420px;
}

.returns-table {
  min-width: 1580px;
}

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

.mistakes-table-wrap {
  height: calc(100vh - 280px);
  min-height: 420px;
}

.mistakes-table th:nth-child(1),
.mistakes-table td:nth-child(1) {
  width: 58px;
  text-align: center;
}

.mistakes-table th:nth-child(5),
.mistakes-table td:nth-child(5) {
  min-width: 320px;
}

.mistake-table-input,
.mistake-table-textarea {
  width: 100%;
  background: var(--control);
}

.mistake-table-textarea {
  min-height: 48px;
  resize: vertical;
}

.signature-cell {
  background: color-mix(in srgb, var(--control), var(--warm) 5%);
}

.returns-table td,
.returns-table th {
  font-size: 12px;
  padding: 8px 9px;
  line-height: 1.25;
}

.returns-table th {
  position: sticky;
  top: 0;
}

.returns-table td {
  vertical-align: middle;
}

.returns-table tfoot td {
  position: sticky;
  bottom: 0;
  z-index: 1;
  background: color-mix(in srgb, var(--panel-strong), var(--warm) 8%);
  border-top: 2px solid color-mix(in srgb, var(--warm), var(--line) 20%);
  font-weight: 900;
}

.returns-table .group-start td {
  border-top: 2px solid color-mix(in srgb, var(--warm), var(--line) 40%);
}

.status-pill,
.file-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.editable-cell {
  width: 100%;
  min-height: 28px;
  padding: 3px 5px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 650;
  justify-content: flex-start;
  overflow: hidden;
  text-overflow: ellipsis;
}

.editable-cell:hover {
  border-color: var(--line);
  background: color-mix(in srgb, var(--accent), transparent 92%);
  transform: none;
}

.inline-input {
  min-height: 32px;
  padding: 0 8px;
  border-radius: 6px;
}

.status-select {
  min-height: 30px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
  border: 1px solid var(--line);
  appearance: auto;
}

.status-select.done {
  color: var(--success);
  background: color-mix(in srgb, var(--success), transparent 88%);
}

.status-select.todo {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning), transparent 86%);
}

.autocomplete-panel {
  position: fixed;
  z-index: 2147483647;
  max-height: 230px;
  overflow: auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: #ffffff;
  color: #1d1d1f;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.18);
  isolation: isolate;
}

.autocomplete-panel button {
  width: 100%;
  min-height: 32px;
  padding: 6px 8px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #1d1d1f;
  text-align: left;
  font-size: 13px;
}

.autocomplete-panel button:hover {
  background: #f1f5f9;
  transform: none;
}

.status-pill.done {
  color: var(--success);
  background: color-mix(in srgb, var(--success), transparent 88%);
}

.status-pill.todo {
  color: var(--warning);
  background: color-mix(in srgb, var(--warning), transparent 86%);
}

.file-pill {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent), transparent 90%);
  text-decoration: none;
}

.pdf-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.pdf-add-button {
  width: 28px;
  min-width: 28px;
  height: 28px;
  min-height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--control);
  color: var(--text);
  font-weight: 900;
}

#returnDialog {
  width: min(1040px, calc(100vw - 28px));
}

#aiReturnDialog {
  width: min(920px, calc(100vw - 28px));
}

#returnForm {
  display: grid;
  max-height: calc(100vh - 34px);
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.return-form-body {
  padding: 20px;
  overflow: auto;
  display: grid;
  gap: 18px;
}

.receipt-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.return-items {
  display: grid;
  gap: 10px;
}

.return-item-row {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 90px 150px 160px 160px 42px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
}

.return-item-row label {
  display: grid;
  gap: 7px;
}

.return-item-row .readonly-money {
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--control), var(--text) 3%);
  font-weight: 800;
}

.remove-item-button {
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.calculation-card {
  padding: 14px;
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

.ai-return-body {
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(260px, 0.85fr) minmax(320px, 1.15fr);
  gap: 16px;
  max-height: calc(100vh - 190px);
  overflow: auto;
}

.ai-upload-panel,
.ai-key-panel,
.ai-result-panel,
.ai-result-card {
  display: grid;
  gap: 12px;
}

.ai-key-panel {
  grid-template-columns: minmax(220px, 1fr) auto;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--control), var(--warning) 6%);
}

.ai-key-panel[hidden] {
  display: none !important;
}

.ai-dropzone {
  min-height: 190px;
  padding: 20px;
  border: 1px dashed color-mix(in srgb, var(--accent), var(--line) 35%);
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--control), var(--accent) 5%);
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  cursor: pointer;
}

.ai-dropzone strong {
  font-size: 20px;
}

.ai-dropzone span,
.ai-status {
  color: var(--muted);
  line-height: 1.45;
}

#aiReturnPreviewImage {
  width: 100%;
  max-height: 310px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
}

.ai-status {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
  font-weight: 700;
}

.ai-result-card {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
}

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

.ai-result-grid div,
.ai-item-row {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: color-mix(in srgb, var(--panel-strong), var(--accent) 2%);
  display: grid;
  gap: 4px;
}

.ai-result-grid span,
.ai-item-row span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-items-list {
  display: grid;
  gap: 8px;
}

.statistics-panel {
  padding: 20px;
  display: grid;
  gap: 18px;
}

.stats-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(140px, 1fr));
  gap: 12px;
}

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

.stats-card {
  padding: 16px;
  display: grid;
  gap: 14px;
  box-shadow: none;
}

.stats-card-head {
  display: grid;
  gap: 4px;
}

.bar-chart {
  display: grid;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(220px, 1.2fr) minmax(130px, 0.9fr) minmax(90px, auto);
  gap: 10px;
  align-items: start;
}

.bar-label {
  white-space: normal;
  overflow-wrap: anywhere;
  font-weight: 800;
  line-height: 1.25;
}

.bar-track {
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: color-mix(in srgb, var(--control), var(--text) 7%);
}

.bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--warm));
}

.bar-value {
  color: var(--muted);
  font-weight: 800;
  text-align: right;
  white-space: nowrap;
}

.donut-wrap {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 18px;
  align-items: center;
}

.donut {
  width: 170px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: conic-gradient(var(--success) var(--done-angle), color-mix(in srgb, var(--warning), transparent 14%) 0);
  display: grid;
  place-items: center;
}

.donut::after {
  content: attr(data-label);
  width: 104px;
  aspect-ratio: 1;
  border-radius: 50%;
  background: var(--panel-strong);
  display: grid;
  place-items: center;
  font-weight: 900;
}

.donut-legend,
.stats-list {
  display: grid;
  gap: 10px;
}

.legend-line,
.stats-list-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
}

.legend-line span,
.stats-list-row span {
  color: var(--muted);
  font-weight: 800;
}

.calc-line {
  display: grid;
  gap: 4px;
}

.calc-line span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.calc-line strong {
  font-size: 22px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 18px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.sort-menu {
  position: relative;
}

.sort-popover {
  position: absolute;
  right: 0;
  top: calc(100% + 8px);
  z-index: 20;
  width: 250px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.sort-popover button {
  width: 100%;
  min-height: 36px;
  padding: 0 10px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  font-weight: 700;
}

.sort-popover button:hover {
  background: color-mix(in srgb, var(--accent), transparent 90%);
  transform: none;
}

.count-pill {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: var(--panel);
  backdrop-filter: blur(20px);
  font-weight: 700;
}

.bulk-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 16px 44px rgba(20, 20, 30, 0.08);
  backdrop-filter: blur(22px);
}

.bulk-bar strong {
  white-space: nowrap;
}

.bulk-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
}

.table-panel {
  min-height: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.table-wrap {
  position: relative;
  height: calc(100vh - 132px);
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  min-width: 1290px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px 14px;
  text-align: left;
  vertical-align: top;
  font-size: 14px;
  overflow: hidden;
}

th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: color-mix(in srgb, var(--panel-strong), transparent 4%);
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  user-select: none;
  overflow: visible;
}

th button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  font: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
}

.column-resizer {
  position: absolute;
  top: 0;
  right: -4px;
  z-index: 5;
  width: 8px;
  height: 100%;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer::after {
  content: "";
  position: absolute;
  top: 22%;
  right: 3px;
  width: 2px;
  height: 56%;
  border-radius: 99px;
  background: transparent;
  transition: background 0.16s ease;
}

.column-resizer:hover::after,
.is-resizing-column .column-resizer::after {
  background: var(--accent);
}

.is-resizing-column {
  cursor: col-resize;
  user-select: none;
}

.select-cell {
  width: 46px;
  min-width: 46px;
  text-align: center;
  vertical-align: middle;
}

.row-checkbox {
  width: 18px;
  height: 18px;
  min-height: 18px;
  padding: 0;
  appearance: auto;
  accent-color: var(--accent);
}

tbody tr {
  transition: background 0.14s ease;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--accent), transparent 92%);
}

tbody tr.is-selected {
  background: color-mix(in srgb, var(--accent), transparent 88%);
}

tbody tr.search-hit {
  background: color-mix(in srgb, var(--warning), transparent 82%);
}

.name-cell {
  min-width: 300px;
  max-width: 440px;
}

.name-cell strong {
  display: block;
  color: var(--text);
  line-height: 1.35;
}

.name-cell span,
.muted {
  color: var(--muted);
}

.code-chip {
  display: inline-flex;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 5px 8px;
  border-radius: 7px;
  border: 1px solid var(--line);
  color: var(--text);
  background: color-mix(in srgb, var(--control), var(--accent) 5%);
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, transform 0.16s ease;
}

.code-chip.supplier-code {
  background: color-mix(in srgb, var(--control), #c28f66 12%);
  border-color: color-mix(in srgb, var(--line), #c28f66 45%);
}

.code-chip:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent), transparent 84%);
  transform: translateY(-1px);
}

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

.row-action {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--control);
  color: var(--text);
  font-weight: 700;
}

.photo-cell {
  width: 76px;
}

.product-photo,
.photo-placeholder {
  width: 52px;
  height: 52px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--control), var(--accent) 4%);
}

.product-photo {
  display: block;
  object-fit: cover;
}

.photo-placeholder {
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 18px;
}

.empty-state {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  gap: 8px;
  text-align: center;
  color: var(--muted);
}

.empty-state strong {
  color: var(--text);
  font-size: 20px;
}

dialog {
  width: min(860px, calc(100vw - 28px));
  max-height: calc(100vh - 34px);
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--panel-strong);
  color: var(--text);
  box-shadow: var(--shadow);
}

dialog::backdrop {
  background: rgba(0, 0, 0, 0.38);
  backdrop-filter: blur(10px);
}

#productForm {
  display: grid;
  max-height: calc(100vh - 34px);
  grid-template-rows: auto minmax(0, 1fr) auto;
}

.dialog-head,
.dialog-actions {
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid var(--line);
}

.dialog-head {
  justify-content: space-between;
}

.dialog-actions {
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.dialog-spacer {
  flex: 1;
}

.form-grid {
  padding: 20px;
  overflow: auto;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 15px;
}

.form-field {
  display: grid;
  gap: 8px;
}

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

.form-field.compact-field textarea {
  min-height: 62px;
}

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

.image-preview-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.image-preview-row .product-photo,
.image-preview-row .photo-placeholder {
  width: 68px;
  height: 68px;
}

.field-hint {
  color: var(--muted);
  font-size: 12px;
}

.calendar-panel {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.brandbook-hero {
  display: grid;
  grid-template-columns: minmax(280px, 0.65fr) minmax(320px, 1fr);
  gap: 18px;
  align-items: end;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--control), var(--warm) 16%), var(--panel)),
    var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(24px);
}

.brandbook-hero h2 {
  margin: 0;
  font-size: clamp(30px, 4vw, 54px);
  line-height: 0.98;
}

.brandbook-hero p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.55;
}

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

.brandbook-card {
  min-height: 260px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: 0 16px 44px rgba(20, 20, 30, 0.08);
  display: grid;
  align-content: start;
  gap: 12px;
  backdrop-filter: blur(24px);
}

.brandbook-number {
  width: 38px;
  height: 38px;
  border-radius: var(--radius);
  background: color-mix(in srgb, var(--warm), transparent 78%);
  color: var(--warm);
  display: inline-grid;
  place-items: center;
  font-weight: 900;
}

.brandbook-card h3 {
  margin: 0;
  font-size: 22px;
}

.brandbook-card ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.45;
}

.brandbook-card li + li {
  margin-top: 6px;
}

.calendar-toolbar {
  display: grid;
  grid-template-columns: minmax(230px, 0.42fr) minmax(420px, 1fr);
  gap: 12px;
  align-items: center;
}

.calendar-quick-add {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 160px auto;
  gap: 8px;
}

.calendar-weekdays,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.calendar-weekdays span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
  letter-spacing: 0;
  text-align: center;
  text-transform: uppercase;
}

.calendar-day {
  aspect-ratio: 1 / 1;
  min-height: 118px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--control);
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  gap: 8px;
  overflow: hidden;
}

.calendar-day.is-adjacent-month {
  opacity: 0.58;
  background: color-mix(in srgb, var(--control), var(--bg) 38%);
}

.calendar-day-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.calendar-day-head strong {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-size: 14px;
  line-height: 1.1;
  min-width: 0;
}

.calendar-day-head strong span {
  font-size: 18px;
}

.calendar-add-button {
  width: 28px;
  height: 28px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: color-mix(in srgb, var(--control), var(--accent) 8%);
  color: var(--accent);
  display: inline-grid;
  place-items: center;
  font-size: 18px;
  font-weight: 800;
  line-height: 1;
}

.calendar-add-button:hover {
  border-color: var(--accent);
  background: color-mix(in srgb, var(--control), var(--accent) 16%);
}

.calendar-events {
  display: grid;
  align-content: start;
  gap: 5px;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
}

.calendar-event {
  min-height: 24px;
  padding: 4px 7px;
  border: 1px solid color-mix(in srgb, var(--accent), var(--line) 54%);
  border-radius: 6px;
  background: color-mix(in srgb, var(--control), var(--accent) 11%);
  color: var(--text);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
  text-align: left;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-event:hover {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--control), var(--danger) 12%);
}

.calendar-event.tone-1 { --event-color: #0a84ff; }
.calendar-event.tone-2 { --event-color: #c28f66; }
.calendar-event.tone-3 { --event-color: #10a37f; }
.calendar-event.tone-4 { --event-color: #d62976; }
.calendar-event.tone-5 { --event-color: #8b5cf6; }
.calendar-event.tone-6 { --event-color: #f59e0b; }
.calendar-event.tone-7 { --event-color: #ef4444; }
.calendar-event.tone-8 { --event-color: #0891b2; }

.calendar-event[class*="tone-"] {
  border-color: color-mix(in srgb, var(--event-color), var(--line) 36%);
  background: color-mix(in srgb, var(--control), var(--event-color) 18%);
}

.calendar-event[class*="tone-"]:hover {
  border-color: var(--event-color);
  background: color-mix(in srgb, var(--control), var(--event-color) 26%);
}

.calendar-event-form {
  padding: 20px;
  display: grid;
  grid-template-columns: minmax(240px, 1fr) 180px;
  gap: 14px;
}

@media (max-width: 920px) {
  .hub-grid,
  .hub-links-panel,
  .hub-dashboard-grid,
  .global-search-panel,
  .returns-summary,
  .stats-kpis,
  .stats-grid,
  .brandbook-hero,
  .brandbook-grid,
  .calendar-toolbar,
  .calendar-quick-add {
    grid-template-columns: 1fr;
  }

  .global-search-results {
    grid-column: 1;
  }

  .hub-header,
  .returns-header,
  .panel-title-row,
  .ledger-actions-row,
  .items-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .month-create,
  .seller-grid,
  .calculation-card,
  .ai-return-body,
  .todo-form,
  .donut-wrap,
  .calendar-event-form {
    grid-template-columns: 1fr;
  }

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

  .bar-value {
    text-align: left;
  }

  .return-item-row {
    grid-template-columns: 1fr 90px 1fr;
  }

  .return-item-row .form-field:first-child {
    grid-column: 1 / -1;
  }

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

  .sidebar {
    position: relative;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

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

  .workspace {
    padding: 20px;
  }

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

  .bulk-bar {
    align-items: flex-start;
    flex-direction: column;
  }

  .bulk-actions {
    justify-content: flex-start;
  }

  .table-wrap {
    height: 68vh;
  }

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

@media (max-width: 620px) {
  .hub-view,
  .returns-view {
    padding: 16px;
  }

  .hub-brand h1 {
    font-size: 32px;
  }

  .hub-card {
    min-height: 180px;
  }

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

  .sidebar,
  .workspace {
    padding: 16px;
  }

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

  h2 {
    font-size: 25px;
  }

  .dialog-actions {
    flex-wrap: wrap;
  }

  .dialog-spacer {
    display: none;
  }

  .dialog-actions button {
    flex: 1 1 130px;
  }

  .calendar-weekdays {
    display: none;
  }

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

  .calendar-day {
    aspect-ratio: auto;
    min-height: 124px;
  }
}

/* Mobile polish: keep the hub usable as a phone-first work surface. */
html,
body {
  max-width: 100%;
  overflow-x: hidden;
  -webkit-text-size-adjust: 100%;
}

img,
svg,
video {
  max-width: 100%;
}

@media (max-width: 760px) {
  body {
    font-size: 14px;
  }

  .auth-gate {
    min-height: 100dvh;
    padding: 14px;
  }

  .auth-card {
    width: 100%;
    padding: 18px;
    border-radius: 14px;
  }

  .auth-logo {
    width: 72px;
    height: 72px;
  }

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

  .sidebar,
  .workspace,
  .hub-view,
  .returns-view {
    padding: 14px;
  }

  .sidebar {
    gap: 12px;
  }

  .brand {
    align-items: center;
    grid-template-columns: auto 1fr;
  }

  .brand-logo {
    width: 46px;
    height: 46px;
  }

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

  .action-button {
    min-height: 38px;
    padding: 0 10px;
    font-size: 13px;
  }

  .topbar,
  .hub-header,
  .returns-header,
  .panel-title-row,
  .ledger-actions-row,
  .bulk-bar {
    gap: 10px;
  }

  .topbar-actions,
  .hub-actions,
  .month-actions,
  .bulk-actions {
    width: 100%;
    justify-content: stretch;
  }

  .topbar-actions button,
  .hub-actions button,
  .month-actions button,
  .bulk-actions button {
    flex: 1 1 0;
  }

  .session-pill {
    width: 100%;
    justify-content: space-between;
  }

  .hub-brand {
    gap: 10px;
  }

  .hub-brand .brand-logo {
    width: 58px;
    height: 58px;
  }

  .hub-brand h1 {
    font-size: 28px;
    line-height: 1.02;
  }

  .hub-brand p,
  .section-subtitle,
  .muted {
    font-size: 13px;
  }

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

  .hub-card {
    min-height: 128px;
    padding: 12px;
    border-radius: 8px;
  }

  .hub-card-icon {
    width: 36px;
    height: 36px;
  }

  .hub-card strong {
    font-size: 16px;
    line-height: 1.15;
  }

  .hub-card span:last-child {
    font-size: 12px;
    line-height: 1.35;
  }

  .hub-dashboard-grid {
    gap: 12px;
  }

  .hub-links-panel,
  .todo-panel,
  .global-search-panel,
  .panel,
  .calendar-panel,
  .brandbook-card,
  .brandbook-hero {
    padding: 12px;
    border-radius: 8px;
  }

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

  .hub-tool-link {
    width: 100%;
    min-width: 0;
    min-height: 34px;
    padding: 0 8px;
    justify-content: flex-start;
    font-size: 11px;
    line-height: 1.15;
  }

  .hub-tool-link svg,
  .hub-tool-link .tool-icon {
    width: 17px;
    height: 17px;
    flex: 0 0 auto;
  }

  .todo-panel-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 4px;
  }

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

  #todoTextInput,
  #addTodoButton {
    grid-column: 1 / -1;
  }

  .todo-item {
    align-items: center;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px;
  }

  .todo-check span {
    font-size: 14px;
    line-height: 1.25;
  }

  .todo-meta {
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
  }

  .todo-meta span {
    min-height: 28px;
    padding: 5px 9px;
    font-size: 11px;
  }

  .global-search-panel {
    gap: 10px;
  }

  .global-search-input {
    min-height: 44px;
    font-size: 15px;
  }

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

  .month-card {
    min-height: 92px;
    padding: 12px;
  }

  .seller-grid,
  .month-create,
  .returns-summary,
  .stats-kpis,
  .stats-grid,
  .brandbook-grid,
  .users-create-form {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .returns-summary {
    padding: 10px;
  }

  .summary-tile,
  .stat-card {
    padding: 12px;
  }

  .returns-table-wrap,
  .mistakes-table-wrap,
  .table-wrap {
    height: auto;
    min-height: 320px;
    max-height: 68dvh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
  }

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

  .mistakes-table {
    min-width: 780px;
  }

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

  .returns-table td,
  .returns-table th,
  .mistakes-table td,
  .mistakes-table th,
  .products-table td,
  .products-table th {
    padding: 7px 8px;
    font-size: 11px;
    line-height: 1.25;
  }

  .editable-cell,
  .cell-input,
  .cell-select {
    min-height: 34px;
  }

  dialog {
    width: calc(100vw - 14px);
    max-height: calc(100dvh - 14px);
    border-radius: 12px;
  }

  .dialog-head,
  .dialog-actions {
    padding: 13px;
  }

  .dialog-head h3 {
    font-size: 20px;
  }

  .dialog-actions {
    position: sticky;
    bottom: 0;
    z-index: 5;
    background: var(--panel-strong);
    border-top: 1px solid var(--line);
  }

  .dialog-actions button {
    min-height: 42px;
  }

  .form-grid,
  .return-form-body,
  .ai-return-body,
  .calendar-event-form {
    padding: 13px;
    gap: 10px;
  }

  .return-item-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
  }

  .return-item-row .form-field:first-child,
  .return-item-row .danger-button {
    grid-column: 1 / -1;
  }

  .product-suggestions,
  .suggestions-list {
    z-index: 80;
    max-width: min(520px, calc(100vw - 28px));
  }

  .calendar-toolbar,
  .calendar-quick-add {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .calendar-weekdays {
    display: none;
  }

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

  .calendar-day {
    aspect-ratio: auto;
    min-height: 132px;
    padding: 8px;
  }

  .calendar-day-head {
    gap: 6px;
  }

  .calendar-add-button {
    width: 26px;
    height: 26px;
    font-size: 16px;
  }

  .calendar-event {
    min-height: 23px;
    padding: 4px 6px;
    font-size: 11px;
  }

  .brandbook-hero h2 {
    font-size: 31px;
  }

  .brandbook-card h3 {
    font-size: 18px;
  }
}

@media (max-width: 430px) {
  .hub-grid,
  .month-grid,
  .tool-links,
  .calendar-grid,
  .todo-form,
  .sidebar-actions {
    grid-template-columns: 1fr;
  }

  .hub-card {
    min-height: 108px;
  }

  .topbar-actions,
  .hub-actions,
  .month-actions,
  .bulk-actions,
  .dialog-actions {
    flex-direction: column;
  }

  .topbar-actions button,
  .hub-actions button,
  .month-actions button,
  .bulk-actions button,
  .dialog-actions button {
    width: 100%;
  }

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

  .returns-table {
    min-width: 1040px;
  }

  .table-wrap table {
    min-width: 860px;
  }
}
