:root {
  --color-primary: #00237d;
  --color-primary-dark: #001a5e;
  --color-primary-light: #e8eeff;
  --color-accent: #e70d2f;
  --color-accent-light: #fde8ec;
  --color-background: #f5f7fb;
  --color-surface: #ffffff;
  --color-border: #e2e8f0;
  --color-text-primary: #172033;
  --color-text-secondary: #64748b;
  --color-success: #16a34a;
  --color-warning: #f59e0b;
  --color-danger: #dc2626;
  --bg: var(--color-background);
  --surface: var(--color-surface);
  --surface-soft: #f8fafc;
  --text: var(--color-text-primary);
  --muted: var(--color-text-secondary);
  --line: var(--color-border);
  --primary: var(--color-primary);
  --primary-soft: var(--color-primary-light);
  --green: var(--color-success);
  --green-soft: #e8f7f1;
  --amber: var(--color-warning);
  --amber-soft: #fff5df;
  --red: var(--color-danger);
  --red-soft: var(--color-accent-light);
  --violet: #7962d8;
  --violet-soft: #f0edff;
  --cyan: #188fa1;
  --cyan-soft: #e8f8fa;
  --shadow: 0 4px 8px rgba(15, 23, 42, 0.06);
  --radius-sm: 8px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --sidebar-width: 248px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 24px 18px;
  background: var(--color-primary);
  color: #fff;
  z-index: 30;
  transition: transform 0.25s ease;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 6px 24px;
}

.brand-logo-frame {
  width: 58px;
  height: 74px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 6px;
  border-radius: var(--radius-sm);
  background: #fff;
}

.brand-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.brand-name {
  font-weight: 800;
  letter-spacing: -0.02em;
}

.brand-subtitle {
  margin-top: 3px;
  color: #c7d2fe;
  font-size: 11px;
}

.nav-menu {
  display: grid;
  gap: 7px;
}

.nav-item {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  border: 0;
  padding: 12px 13px;
  border-radius: 10px;
  background: transparent;
  color: #b8c3d7;
  text-align: left;
  font-weight: 600;
  transition: 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
  background: rgba(255,255,255,0.13);
  color: #fff;
}

.nav-item.active {
  background: #fff;
  color: var(--color-primary);
}

.nav-icon {
  width: 20px;
  text-align: center;
  color: #c7d2fe;
}

.nav-item.active .nav-icon { color: var(--color-accent); }

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 14px 6px 0;
  border-top: 1px solid rgba(255,255,255,0.1);
}

.avatar {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: #dce6ff;
  color: #244eaa;
  font-size: 12px;
  font-weight: 800;
}

.user-meta {
  min-width: 0;
  flex: 1;
  display: grid;
}

.user-meta strong {
  font-size: 12px;
}

.user-meta span {
  color: #9ba9c1;
  font-size: 10px;
}

.ghost-icon {
  border: 0;
  background: transparent;
  color: #9ba9c1;
}

.main-content {
  margin-left: var(--sidebar-width);
  max-width: 1600px;
  padding: 24px 28px 36px;
}

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

.topbar-left,
.topbar-actions {
  display: flex;
  align-items: center;
}

.topbar-left {
  gap: 12px;
}

.topbar h1 {
  margin: 2px 0 0;
  font-size: 28px;
  letter-spacing: -0.03em;
  text-wrap: balance;
}

.page-context {
  margin: 0;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

.page-description {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.eyebrow {
  margin: 0;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.topbar-actions {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.connection-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 42px;
  padding: 0 11px;
  border-radius: 10px;
  background: #ecfdf3;
  color: #166534;
  font-size: 10px;
  font-weight: 700;
  white-space: nowrap;
}

.connection-status i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}

.connection-status.offline { background: var(--amber-soft); color: #92400e; }
.connection-status.offline i { background: var(--amber); }

.return-landing-button {
  align-self: stretch;
  width: 46px;
  min-height: 96px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--primary);
  font-size: 11px;
  font-weight: 700;
}

.return-landing-button svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-linecap: round; stroke-linejoin: round; stroke-width: 2.5; }
.return-landing-button:hover { background: var(--primary-soft); }
.return-landing-button:focus-visible { outline: 3px solid #91a5dd; outline-offset: 2px; }

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
}

.search-box {
  min-width: 260px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
}

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

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--text);
  font-size: 12px;
}

.date-pill,
.notification-button {
  height: 42px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  color: var(--text);
}

.date-pill {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 0 13px;
  font-size: 11px;
  font-weight: 700;
}

.notification-button {
  position: relative;
  width: 42px;
  font-size: 18px;
}

.notification-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 7px;
  height: 7px;
  border: 2px solid white;
  border-radius: 50%;
  background: var(--red);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.summary-card {
  display: flex;
  align-items: center;
  gap: 14px;
  min-height: 116px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.summary-card p {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.summary-card h2 {
  margin: 0 0 7px;
  font-size: 25px;
  letter-spacing: -0.04em;
}

.summary-icon {
  flex: 0 0 45px;
  width: 45px;
  height: 45px;
  display: grid;
  place-items: center;
  border-radius: 13px;
  font-weight: 800;
}

.summary-icon.blue { background: var(--primary-soft); color: var(--primary); }
.summary-icon.violet { background: var(--violet-soft); color: var(--violet); }
.summary-icon.amber { background: var(--amber-soft); color: var(--amber); }
.summary-icon.green { background: var(--green-soft); color: var(--green); }

.summary-note {
  color: var(--muted);
  font-size: 10px;
}

.summary-note.positive { color: var(--green); }
.summary-note.warning { color: var(--amber); }

.toolbar-card {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
  padding: 17px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.toolbar-card h2 {
  margin: 4px 0 0;
  font-size: 18px;
}

.filter-row {
  display: flex;
  align-items: flex-end;
  gap: 10px;
}

.select-control {
  display: grid;
  gap: 5px;
}

.select-control span {
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
}

.select-control select {
  height: 40px;
  min-width: 155px;
  padding: 0 34px 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  outline: 0;
  background: var(--surface);
  color: var(--text);
  font-size: 11px;
  font-weight: 600;
}

.primary-button,
.secondary-button,
.text-button,
.calendar-nav,
.modal-close {
  border: 0;
}

.primary-button {
  min-height: 42px;
  padding: 0 16px;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-size: 12px;
  font-weight: 600;
  transition: background 150ms ease, transform 150ms ease;
}

.primary-button:hover { background: var(--color-primary-dark); }
.primary-button:active { transform: translateY(1px); }
.primary-button:focus-visible,
.secondary-button:focus-visible,
.text-button:focus-visible,
.danger-text-button:focus-visible,
.nav-item:focus-visible,
.calendar-day:focus-visible,
.calendar-nav:focus-visible,
.modal-close:focus-visible,
.notification-button:focus-visible,
.date-pill:focus-visible,
.menu-toggle:focus-visible {
  outline: 3px solid rgba(0, 35, 125, 0.24);
  outline-offset: 2px;
}

.secondary-button {
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  color: var(--primary);
  font-size: 11px;
  font-weight: 600;
}

.secondary-button:hover { background: var(--primary-soft); border-color: #b8c6ed; }

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.8fr) minmax(295px, 0.75fr);
  gap: 14px;
  margin-bottom: 14px;
}

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

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 17px 18px;
  border-bottom: 1px solid var(--line);
}

.panel-header h3 {
  margin: 4px 0 0;
  font-size: 15px;
}

.calendar-title-wrap,
.legend,
.calendar-header {
  display: flex;
  align-items: center;
}

.calendar-header {
  justify-content: space-between;
}

.calendar-title-wrap {
  gap: 10px;
}

.calendar-title-wrap h3 {
  min-width: 152px;
  margin: 0;
  text-align: center;
  font-size: 16px;
}

.calendar-nav {
  width: 31px;
  height: 31px;
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--text);
  font-size: 22px;
}

.legend {
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 12px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 600;
}

.legend span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.legend-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
}

.legend-dot.incoming { background: var(--green); }
.legend-dot.outgoing { background: var(--red); }
.legend-dot.expiry { background: var(--amber); }
.legend-dot.transfer { background: var(--violet); }

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

.calendar-weekdays {
  padding: 0 12px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfe;
}

.calendar-weekdays span {
  padding: 11px 5px;
  color: #8d97a9;
  font-size: 9px;
  font-weight: 800;
  text-align: center;
  text-transform: uppercase;
}

.calendar-grid {
  min-height: 540px;
  padding: 0 12px 14px;
}

.calendar-day {
  position: relative;
  min-width: 0;
  min-height: 108px;
  padding: 9px 8px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  background: var(--surface);
  transition: 0.18s ease;
}

.calendar-day:nth-child(7n) {
  border-right: 0;
}

.calendar-day:hover {
  z-index: 2;
  background: #f9fbff;
  box-shadow: inset 0 0 0 1px #bcd0ff;
}

.calendar-day.outside {
  background: #fbfcfe;
  color: #b2bac8;
}

.calendar-day.today {
  background: #f5f8ff;
  box-shadow: inset 0 0 0 2px var(--primary);
}

.day-number {
  width: 25px;
  height: 25px;
  display: grid;
  place-items: center;
  margin-bottom: 6px;
  border-radius: 8px;
  font-size: 10px;
  font-weight: 800;
}

.calendar-day.today .day-number {
  background: var(--primary);
  color: white;
}

.day-events {
  display: grid;
  gap: 4px;
}

.calendar-event {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 6px;
  border: 0;
  border-radius: 7px;
  text-align: left;
  font-size: 8px;
  font-weight: 700;
  line-height: 1.2;
}

.calendar-event span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-dot {
  flex: 0 0 5px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
}

.calendar-event.incoming { background: var(--green-soft); color: #0e7f56; }
.calendar-event.incoming .event-dot { background: var(--green); }
.calendar-event.outgoing { background: var(--red-soft); color: #b83948; }
.calendar-event.outgoing .event-dot { background: var(--red); }
.calendar-event.expiry { background: var(--amber-soft); color: #a4670e; }
.calendar-event.expiry .event-dot { background: var(--amber); }
.calendar-event.transfer { background: var(--violet-soft); color: #634abf; }
.calendar-event.transfer .event-dot { background: var(--violet); }
.calendar-event.adjustment { background: var(--cyan-soft); color: #0f7483; }
.calendar-event.adjustment .event-dot { background: var(--cyan); }

.more-events {
  padding: 3px 4px;
  color: var(--primary);
  font-size: 8px;
  font-weight: 800;
}

.right-column {
  display: grid;
  gap: 14px;
  align-content: start;
}

.compact-panel {
  overflow: hidden;
}

.text-button {
  background: transparent;
  color: var(--primary);
  font-size: 10px;
  font-weight: 700;
}

.activity-list,
.expiry-list {
  display: grid;
  gap: 0;
}

.activity-item,
.expiry-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.activity-item:last-child,
.expiry-item:last-child {
  border-bottom: 0;
}

.activity-icon {
  flex: 0 0 32px;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 800;
}

.activity-icon.incoming { background: var(--green-soft); color: var(--green); }
.activity-icon.outgoing { background: var(--red-soft); color: var(--red); }
.activity-icon.transfer { background: var(--violet-soft); color: var(--violet); }
.activity-icon.adjustment { background: var(--cyan-soft); color: var(--cyan); }
.activity-icon.expiry { background: var(--amber-soft); color: var(--amber); }

.activity-body,
.expiry-body {
  min-width: 0;
  flex: 1;
}

.activity-row,
.expiry-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.activity-body strong,
.expiry-body strong {
  display: block;
  overflow: hidden;
  color: var(--text);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-body p,
.expiry-body p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 9px;
  line-height: 1.5;
}

.activity-qty {
  flex: 0 0 auto;
  font-size: 10px;
  font-weight: 800;
}

.activity-qty.incoming { color: var(--green); }
.activity-qty.outgoing { color: var(--red); }
.activity-qty.transfer { color: var(--violet); }
.activity-qty.adjustment { color: var(--cyan); }

.alert-badge {
  padding: 5px 7px;
  border-radius: 7px;
  background: var(--amber-soft);
  color: var(--amber);
  font-size: 9px;
  font-weight: 800;
}

.expiry-date-badge {
  flex: 0 0 auto;
  min-width: 43px;
  padding: 6px 7px;
  border-radius: 8px;
  background: var(--red-soft);
  color: var(--red);
  font-size: 8px;
  font-weight: 800;
  text-align: center;
}

.expiry-date-badge.warning {
  background: var(--amber-soft);
  color: var(--amber);
}

.expiry-progress {
  height: 4px;
  margin-top: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf0f5;
}

.expiry-progress > span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--amber);
}

.table-panel {
  overflow: hidden;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  white-space: nowrap;
}

th {
  background: #fbfcfe;
  color: #7d879a;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

td {
  color: #42506a;
  font-size: 12px;
}

tbody tr:hover {
  background: #fafcff;
}

.priority-number {
  width: 24px;
  height: 24px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
  font-weight: 800;
}

.product-cell strong {
  display: block;
  color: var(--text);
  font-size: 12px;
}

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

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 8px;
  border-radius: 999px;
  font-size: 8px;
  font-weight: 800;
}

.status-pill.critical { background: var(--red-soft); color: #921313; }
.status-pill.warning { background: var(--amber-soft); color: #623900; }
.status-pill.safe { background: var(--green-soft); color: #08441f; }

.empty-state {
  padding: 26px 18px;
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.empty-state strong,
.empty-state span {
  display: block;
}

.empty-state strong { margin-bottom: 5px; color: var(--text); font-size: 12px; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(10, 20, 39, 0.55);
  backdrop-filter: blur(5px);
  z-index: 100;
}

.modal-backdrop.hidden {
  display: none;
}

.modal-card {
  width: min(640px, 100%);
  max-height: 82vh;
  overflow: hidden;
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: 0 24px 80px rgba(10,20,39,0.28);
}

.modal-card.modal-wide { width: min(860px, 100%); }

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 5px 0 0;
  font-size: 18px;
}

.modal-close {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: var(--surface-soft);
  color: var(--muted);
  font-size: 23px;
}

.modal-content {
  max-height: 62vh;
  overflow-y: auto;
  padding: 12px 20px 20px;
}

.dynamic-view {
  margin-top: 18px;
}

.hidden {
  display: none !important;
}

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

.data-form label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 11px;
  font-weight: 700;
}

.data-form input,
.data-form select {
  width: 100%;
  height: 42px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  outline: none;
}

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

.view-header h2 {
  margin: 0;
  font-size: 20px;
  letter-spacing: -0.02em;
}

.view-header p,
.panel-subtitle {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.stock-form {
  display: grid;
  gap: 16px;
  padding-top: 8px;
}

.form-section {
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: #fff;
}

.form-section-heading {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-bottom: 16px;
}

.form-section-heading > span {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: var(--radius-sm);
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
}

.form-section-heading h3 { margin: 0; font-size: 14px; }
.form-section-heading p { margin: 4px 0 0; color: var(--muted); font-size: 11px; }

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

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

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

.field > span,
.data-form label {
  color: var(--text);
  font-size: 12px;
  font-weight: 600;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 11px;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  outline: 0;
  background: #fff;
  color: var(--text);
  font-size: 13px;
}

.field textarea { resize: vertical; line-height: 1.5; }

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 35, 125, 0.18);
}

.field input::placeholder { color: #64748b; }

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

.segmented-control.compact { margin-bottom: 14px; }
.segmented-control label { cursor: pointer; }
.segmented-control input { position: absolute; opacity: 0; pointer-events: none; }
.segmented-control span {
  min-height: 42px;
  display: grid;
  place-items: center;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  transition: 150ms ease;
}

.segmented-control input:checked + span {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--primary);
}

.segmented-control input:focus-visible + span { box-shadow: 0 0 0 3px rgba(0,35,125,0.18); }

.stock-form-actions {
  position: sticky;
  bottom: -20px;
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin: 0 -20px -20px;
  padding: 14px 20px;
  border-top: 1px solid var(--line);
  background: rgba(255,255,255,0.98);
  z-index: 2;
}

.draft-panel { margin-bottom: 16px; overflow: hidden; }
.count-badge { min-width: 28px; padding: 5px 8px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); font-size: 11px; font-weight: 800; text-align: center; }
.draft-list { display: grid; }
.draft-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}
.draft-row:last-child { border-bottom: 0; }
.draft-row strong,.draft-row span { display: block; }
.draft-row strong { font-size: 12px; }
.draft-row span { margin-top: 4px; color: var(--muted); font-size: 10px; }
.row-actions { display: flex; align-items: center; gap: 8px; }
.danger-text-button { border: 0; background: transparent; color: var(--red); font-size: 10px; font-weight: 700; }
.positive-qty { color: var(--green); font-weight: 800; }

.report-summary {
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow);
}
.report-summary > div { padding: 22px; border-right: 1px solid var(--line); }
.report-summary > div:last-child { border-right: 0; }
.report-summary span,.report-summary strong { display: block; }
.report-summary span { color: var(--muted); font-size: 11px; }
.report-summary strong { margin-top: 7px; font-size: 21px; letter-spacing: -0.03em; }
.report-summary .attention strong { color: var(--red); }

.data-form input:focus,
.data-form select:focus,
.select-control select:focus,
.search-box:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-help {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 9px;
  margin-top: 4px;
}

.report-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.report-stats > div {
  display: grid;
  gap: 6px;
  padding: 22px;
  border-right: 1px solid var(--line);
}

.report-stats > div:last-child { border-right: 0; }
.report-stats span { color: var(--muted); font-size: 11px; }
.report-stats strong { font-size: 20px; letter-spacing: -0.03em; }

.modal-section-title {
  margin: 16px 0 8px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
}

.modal-event {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.modal-event:last-child {
  border-bottom: 0;
}

.modal-event-meta {
  min-width: 0;
  flex: 1;
}

.modal-event-meta strong {
  display: block;
  font-size: 12px;
}

.modal-event-meta span {
  color: var(--muted);
  font-size: 9px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  transform: translateY(18px);
  padding: 12px 15px;
  border-radius: 10px;
  background: #172033;
  color: white;
  font-size: 11px;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
  z-index: 200;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast[data-type="success"] { background: #14532d; }
.toast[data-type="error"] { background: #991b1b; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

@media (max-width: 1180px) {
  .topbar { align-items: flex-start; }
  .topbar-actions { max-width: 56%; }

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

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

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

  .report-summary { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .report-summary > div:nth-child(2) { border-right: 0; }
  .report-summary > div:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}

@media (max-width: 920px) {
  .sidebar {
    transform: translateX(-100%);
  }

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

  .main-content {
    margin-left: 0;
    padding: 18px;
  }

  .menu-toggle {
    display: block;
  }

  .topbar,
  .toolbar-card {
    align-items: flex-start;
  }

  .topbar-actions,
  .filter-row {
    flex-wrap: wrap;
    justify-content: flex-end;
  }

  .topbar-actions { max-width: none; }

  .connection-status { order: 3; }

  .search-box {
    min-width: 220px;
  }

  .calendar-day {
    min-height: 96px;
    padding: 7px 5px;
  }

  .calendar-event {
    padding: 4px;
  }
}

@media (max-width: 680px) {
  .topbar {
    display: grid;
  }

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

  .search-box {
    flex: 1 1 100%;
    min-width: 0;
  }

  .summary-grid,
  .right-column,
  .report-stats,
  .report-summary,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .report-summary > div,
  .report-summary > div:nth-child(2) {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .report-summary > div:last-child { border-bottom: 0; }

  .report-stats > div {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .report-stats > div:last-child { border-bottom: 0; }

  .toolbar-card,
  .calendar-header {
    display: grid;
  }

  .view-header,
  .draft-row {
    align-items: stretch;
    display: grid;
  }

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

  .filter-row {
    justify-content: flex-start;
  }

  .select-control,
  .select-control select,
  .primary-button {
    width: 100%;
  }

  .stock-form-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .stock-form-actions .primary-button,
  .stock-form-actions .secondary-button { width: 100%; }

  .form-section { padding: 15px; }

  .calendar-panel {
    overflow-x: auto;
  }

  .calendar-weekdays,
  .calendar-grid {
    min-width: 720px;
  }

  .legend {
    justify-content: flex-start;
  }
}
