:root {
  color-scheme: light;
  --bg: #f4f4f0;
  --surface: #ffffff;
  --surface-soft: #eef4ef;
  --ink: #123b38;
  --muted: #526260;
  --line: #d9ddd6;
  --teal: #166f70;
  --teal-dark: #124744;
  --purple: #6f52b5;
  --danger: #b3261e;
  --warning: #b46b00;
  --ok: #0b7a53;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
}

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

button {
  cursor: pointer;
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: start center;
  background: #050606;
  padding: 14px 24px 40px;
}

.login-wrap {
  width: min(440px, 100%);
}

.login-logo {
  display: block;
  width: 210px;
  height: auto;
  margin: 0 auto 8px;
}

.login-card,
.panel,
.stat,
.data-card {
  background: var(--surface);
  border-radius: 8px;
  box-shadow: 0 1px 0 rgba(18, 59, 56, 0.04);
}

.login-card {
  padding: 28px;
  border-radius: 22px;
}

.login-card h1,
.page-title h1 {
  margin: 0;
  letter-spacing: 0;
}

.login-card p,
.page-title p {
  color: var(--muted);
  margin: 6px 0 0;
}

.field {
  display: grid;
  gap: 7px;
  margin-top: 18px;
}

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

.field input,
.field select {
  width: 100%;
  border: 1px solid #7f7788;
  border-radius: 4px;
  padding: 14px 15px;
  background: white;
  color: #17151f;
}

.primary-btn,
.ghost-btn,
.danger-btn {
  border: 0;
  border-radius: 999px;
  min-height: 44px;
  padding: 0 18px;
  font-weight: 800;
}

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

.ghost-btn {
  background: white;
  color: var(--purple);
  border: 1px solid #7f7788;
}

.ghost-btn:disabled,
.primary-btn:disabled,
.danger-btn:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.cash-day-action {
  margin-top: 12px;
}

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

.link-btn {
  border: 0;
  background: transparent;
  color: var(--teal-dark);
  padding: 0;
  font-weight: 900;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.compact-btn {
  min-height: 34px;
  padding: 0 12px;
  white-space: nowrap;
}

.error {
  margin-top: 14px;
  padding: 12px 14px;
  background: #fff1f0;
  border: 1px solid #ffd0cc;
  color: var(--danger);
  border-radius: 6px;
  font-weight: 700;
}

.success {
  margin: 0 0 14px;
  padding: 12px 14px;
  background: #edfff7;
  border: 1px solid #bfead8;
  color: var(--ok);
  border-radius: 6px;
  font-weight: 800;
}

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

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

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

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

.brand strong {
  display: block;
  font-size: 1.1rem;
}

.brand small,
.user-chip small {
  color: rgba(255, 255, 255, 0.72);
}

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

.nav button {
  border: 0;
  text-align: left;
  background: transparent;
  color: rgba(255, 255, 255, 0.82);
  padding: 12px 14px;
  border-radius: 8px;
  font-weight: 800;
}

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

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.content {
  padding: 28px;
  overflow: hidden;
}

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

.page-title h1 {
  font-size: clamp(1.8rem, 3vw, 2.8rem);
  color: var(--ink);
}

.status-pill {
  display: inline-flex;
  gap: 8px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--teal-dark);
  font-weight: 800;
}

.grid {
  display: grid;
  gap: 16px;
}

.stats {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.stat {
  padding: 18px;
}

.stat span {
  color: var(--muted);
  font-weight: 700;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 1.9rem;
}

.main-grid {
  grid-template-columns: 1.2fr 0.8fr;
  align-items: start;
}

.panel {
  padding: 18px;
}

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

.panel h2 {
  margin: 0;
  font-size: 1.25rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 14px;
}

.toolbar input,
.toolbar select,
.form-grid input,
.form-grid select {
  min-height: 42px;
  border: 1px solid #b9bdb7;
  border-radius: 4px;
  padding: 0 12px;
  background: white;
}

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

.form-grid .field {
  margin-top: 0;
}

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

.preview-box {
  border: 1px dashed #b9bdb7;
  background: #fbfcfa;
  border-radius: 6px;
  padding: 14px;
  color: var(--muted);
  font-weight: 700;
}

.checkbox-field {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
}

.checkbox-field input {
  width: 18px;
  height: 18px;
  min-height: 0;
}

.entry-locked-field {
  position: relative;
}

.entry-unlock {
  position: absolute;
  top: 18px;
  right: 0;
  min-height: 0;
  gap: 6px;
  font-size: 0.85rem;
}

.entry-unlock[hidden] {
  display: none;
}

.entry-locked-field:has(.entry-unlock:not([hidden])) .field > span {
  padding-right: 95px;
}

.entry-locked-field input[readonly] {
  background: #f3f5f2;
}

.package-fields {
  padding: 12px;
  border: 1px solid #edf0eb;
  border-radius: 6px;
  background: #fbfcfa;
}

.entry-screen {
  display: grid;
  gap: 14px;
}

.entry-mode-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 10px;
  max-width: 620px;
}

.entry-mode-switch button {
  min-height: 52px;
  border: 1px solid #d9ddd6;
  border-radius: 999px;
  background: white;
  color: var(--teal-dark);
  font-weight: 900;
}

.entry-mode-switch button.active {
  background: var(--teal);
  color: white;
  border-color: var(--teal);
}

.entry-mode-switch button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.entry-panel {
  max-width: 1180px;
}

.entry-landscape-form {
  display: grid;
  grid-template-columns: minmax(280px, 0.9fr) minmax(360px, 1.1fr);
  gap: 18px;
  align-items: start;
}

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

.entry-form-column h3 {
  margin: 0;
  color: var(--ink);
  font-size: 1.1rem;
}

.exit-screen {
  max-width: 1180px;
  display: grid;
  gap: 14px;
}

.exit-mode-block {
  display: grid;
  gap: 10px;
}

.exit-mode-block h2 {
  margin: 0;
  color: #183a37;
  font-size: 1.15rem;
}

.exit-mode-switch {
  max-width: 820px;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
}

.scan-sale-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.correction-panel {
  margin-bottom: 16px;
  border: 1px solid #dcd4ef;
}

.correction-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 18px;
  margin-bottom: 14px;
  color: var(--muted);
}

.correction-summary strong {
  color: var(--ink);
}

.detail-list {
  display: grid;
  gap: 9px;
}

.detail-line {
  display: grid;
  grid-template-columns: minmax(130px, 0.45fr) minmax(180px, 1fr);
  gap: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #edf0eb;
}

.detail-line span {
  color: var(--muted);
  font-weight: 800;
}

.detail-line strong {
  color: var(--ink);
}

.nested-grid {
  margin: 0;
}

.export-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.export-grid.spaced {
  margin-top: 14px;
}

.file-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-btn input {
  display: none;
}

.card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.danger-panel {
  margin-top: 16px;
  border: 1px solid #ffd0cc;
  background: #fffafa;
}

.toolbar input {
  min-width: min(360px, 100%);
  flex: 1;
}

.table-wrap {
  overflow: auto;
  border-radius: 8px;
  border: 1px solid #edf0eb;
}

.stock-filter-panel {
  display: grid;
  gap: 12px;
  margin-bottom: 14px;
}

.stock-filter-panel input {
  width: 100%;
  min-height: 52px;
  border: 1px solid #7f7788;
  border-radius: 4px;
  padding: 0 16px;
  background: white;
  font-size: 1rem;
}

.stock-filter-panel h2 {
  margin: 0;
  color: #183a37;
  font-size: 1.15rem;
}

.stock-filter-panel p {
  margin: 0;
  color: #4f5d5b;
  font-size: 1.05rem;
}

.stock-category-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.stock-category-pills button {
  min-width: 150px;
  min-height: 52px;
  border: 0;
  border-radius: 999px;
  background: white;
  color: #183a37;
  font-weight: 900;
}

.stock-category-pills button.active {
  background: var(--teal);
  color: white;
}

.two-column-pills {
  display: grid;
  grid-template-columns: repeat(2, minmax(160px, 1fr));
}

.selector-row {
  display: grid;
  grid-template-columns: minmax(86px, 0.6fr) minmax(180px, 1.4fr) minmax(86px, 0.6fr);
  gap: 10px;
  align-items: center;
}

.selector-value {
  min-height: 54px;
  display: grid;
  place-items: center;
  padding: 0 18px;
  border-radius: 8px;
  background: #ffffff;
  color: #183a37;
  font-weight: 900;
  text-align: center;
}

.stock-section {
  display: grid;
  gap: 6px;
  margin-top: 14px;
}

.stock-section-head {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  border-radius: 8px;
  background: #e7ece8;
  color: #183a37;
}

.stock-section-head strong {
  font-size: 1.25rem;
}

.stock-section-head span {
  color: #4f5d5b;
  font-weight: 900;
}

.stock-table-wrap {
  overflow: auto;
  border-radius: 8px;
}

.stock-table {
  min-width: 1320px;
}

.stock-table th {
  white-space: nowrap;
}

.stock-table td {
  background: white;
}

.stock-table tr.stock-low td {
  background: #fff4e5;
}

.stock-product-cell {
  min-width: 180px;
}

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

th {
  background: var(--teal-dark);
  color: white;
  text-align: left;
  padding: 13px;
  font-size: 0.9rem;
}

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

tbody tr:hover {
  background: #fbfcfa;
}

.name-cell {
  font-weight: 900;
}

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

.badge {
  display: inline-flex;
  border-radius: 999px;
  padding: 5px 9px;
  background: var(--surface-soft);
  color: var(--teal-dark);
  font-size: 0.82rem;
  font-weight: 900;
}

.badge.warn {
  background: #fff5e5;
  color: var(--warning);
}

.badge.danger {
  background: #fff1f0;
  color: var(--danger);
}

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

.data-card {
  padding: 14px;
  border: 1px solid #edf0eb;
}

.data-card strong {
  display: block;
  margin-bottom: 6px;
}

.empty {
  padding: 24px;
  color: var(--muted);
  background: white;
  border-radius: 8px;
}

.android-home {
  max-width: 920px;
  display: grid;
  gap: 14px;
}

.home-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.home-title-wrap {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.home-avatar {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 10px;
  background: #e8fff4;
  color: #0c8b8b;
  font-weight: 900;
}

.home-header h1 {
  margin: 0;
  color: #073b3a;
  font-size: clamp(1.8rem, 3vw, 2.35rem);
  line-height: 1.08;
}

.home-user {
  margin: 0;
  color: #4f5d5b;
  font-size: 1.05rem;
}

.home-section-title {
  margin: 6px 0 0;
  color: #101828;
  font-size: 1.35rem;
  line-height: 1.2;
}

.home-summary-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 12px;
}

.home-stat {
  min-height: 102px;
  display: grid;
  align-content: center;
  gap: 10px;
  padding: 20px 18px;
  border-radius: 14px;
  border: 1px solid #e6e9e2;
  box-shadow: 0 2px 5px rgba(18, 59, 56, 0.12);
}

.home-stat span {
  color: #4f5d5b;
  font-weight: 500;
}

.home-stat strong {
  color: #073b3a;
  font-size: 1.85rem;
  line-height: 1;
}

.home-stat.mint {
  background: #f0fff7;
}

.home-stat.blue {
  background: #f1f8ff;
}

.home-stat.cream {
  background: #fff7ed;
}

.home-stat.white {
  background: #ffffff;
}

.home-wide-btn {
  width: 100%;
}

.product-detail-page {
  gap: 12px;
}

.product-history-card {
  display: grid;
  gap: 10px;
}

.compact-detail-list {
  gap: 4px;
}

.compact-detail-list .detail-line {
  padding: 4px 0;
}

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

.home-red-pill {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 0 14px;
  border-radius: 999px;
  background: #ffe1e6;
  color: #d92d20;
  font-size: 0.88rem;
  font-weight: 900;
  white-space: nowrap;
}

.home-refill,
.home-actions {
  display: grid;
  gap: 12px;
}

.home-refill-card,
.home-empty-card {
  width: 100%;
  padding: 18px;
  border: 0;
  border-radius: 14px;
  background: #ffffff;
  box-shadow: 0 2px 5px rgba(18, 59, 56, 0.12);
  text-align: left;
}

.home-refill-card {
  cursor: pointer;
}

.home-refill-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 4px 0;
}

.home-refill-line strong {
  color: #155e63;
  font-size: 1.05rem;
}

.home-refill-line span {
  min-width: 34px;
  min-height: 34px;
  display: inline-grid;
  place-items: center;
  padding: 0 10px;
  border-radius: 999px;
  background: #ffe1e6;
  color: #d92d20;
  font-weight: 900;
}

.home-refill-card p,
.home-empty-card {
  margin: 10px 0 0;
  color: #667085;
}

.android-list-page {
  max-width: 1180px;
  display: grid;
  gap: 14px;
}

.android-page-header {
  display: flex;
  align-items: center;
  gap: 16px;
}

.android-page-header h1 {
  margin: 0;
  color: #183a37;
  font-size: clamp(1.8rem, 3vw, 2.35rem);
  line-height: 1.1;
}

.android-page-subtitle {
  margin: 0;
  color: #4f5d5b;
  font-size: 1.1rem;
}

.low-stock-group {
  display: grid;
  gap: 12px;
}

.low-stock-category {
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 0 16px;
  border-radius: 8px;
  background: #e7eeea;
  color: #183a37;
}

.low-stock-category strong {
  font-size: 1.25rem;
}

.low-stock-category span {
  font-weight: 900;
  color: #5f6b68;
}

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

.low-stock-card {
  display: grid;
  gap: 10px;
  padding: 18px;
  border-radius: 14px;
  background: white;
  box-shadow: 0 2px 5px rgba(18, 59, 56, 0.12);
}

.low-stock-title {
  font-size: 1.2rem;
  text-decoration: none;
}

.low-stock-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.low-stock-line span {
  color: #4f5d5b;
  font-weight: 900;
}

.low-stock-line strong {
  color: #183a37;
  text-align: right;
}

.danger-text {
  color: #d92d20 !important;
}

.home-action {
  width: 100%;
  min-height: 96px;
  display: grid;
  grid-template-columns: 50px minmax(0, 1fr) 24px;
  align-items: center;
  gap: 14px;
  border: 1px solid transparent;
  border-radius: 14px;
  padding: 18px;
  text-align: left;
  box-shadow: 0 2px 5px rgba(18, 59, 56, 0.12);
}

.home-action.green {
  background: #e8fff4;
  color: #08a36d;
}

.home-action.blue {
  background: #eaf4ff;
  color: #2377e6;
}

.home-action.purple {
  background: #f7edff;
  color: #7a3db8;
}

.home-action.orange {
  background: #fff6e6;
  color: #d28a10;
}

.home-action.gold {
  background: #fff2d9;
  color: #d28a10;
}

.home-action.teal {
  background: #eaf8f7;
  color: #0c8b8b;
}

.home-action.violet {
  background: #f1f0ff;
  color: #6d50b2;
}

.home-action.red {
  background: #ffeef0;
  color: #b3261e;
}

.home-action-icon {
  width: 50px;
  height: 50px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
  font-weight: 900;
}

.home-action-copy {
  display: grid;
  gap: 4px;
}

.home-action-copy strong {
  color: #155e63;
  font-size: 1.28rem;
  line-height: 1.15;
}

.home-action-copy small {
  color: #4f5d5b;
  font-size: 1rem;
}

.home-action-arrow {
  justify-self: end;
  font-size: 2rem;
  line-height: 1;
  font-weight: 900;
}

.connection-footer {
  min-height: 36px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px 18px;
  margin-top: 4px;
  padding: 9px 12px;
  background: #e0dfda;
  color: #1f2927;
  font-size: 0.82rem;
  font-weight: 800;
}

.online-dot,
.offline-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.online-dot {
  background: #12b76a;
}

.offline-dot {
  background: #f04438;
}

@media (max-width: 980px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .stats,
  .main-grid,
  .form-grid,
  .entry-landscape-form {
    grid-template-columns: 1fr;
  }

  .topbar {
    flex-direction: column;
  }
}

@media (max-width: 640px) {
  .content {
    padding: 18px;
  }

  .home-header {
    align-items: flex-start;
  }

  .home-summary-grid {
    grid-template-columns: 1fr 1fr;
  }

  .home-action {
    grid-template-columns: 48px minmax(0, 1fr) 20px;
    min-height: 88px;
    padding: 16px;
  }

  .entry-mode-switch {
    grid-template-columns: 1fr;
  }
}

[hidden] { display: none !important; }
.operation-date-panel { display: flex; flex-wrap: wrap; align-items: flex-start; gap: 16px; }
.operation-date-panel > div { flex: 1 1 360px; }
.operation-date-panel p { margin: 8px 0; }
