:root {
  color-scheme: light;
  --bg: #f4f7fb;
  --panel: #ffffff;
  --ink: #07111f;
  --muted: #6b7788;
  --line: #dde6f2;
  --soft: #f0f5fb;
  --blue: #0877ff;
  --blue-dark: #005bd1;
  --blue-soft: #e8f2ff;
  --danger: #c93030;
  --ok: #0a8f55;
  --shadow: 0 18px 42px rgba(8, 26, 52, 0.10);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, #ffffff 0, var(--bg) 280px),
    var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app {
  max-width: 980px;
  margin: 0 auto;
  padding: 14px;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 0 12px;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(16px);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

.icon-btn {
  width: 44px;
  height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 22px;
}

.icon-btn svg {
  width: 20px;
  height: 20px;
}

.profile {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.profile strong {
  display: block;
  line-height: 1.25;
}

.profile span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.status {
  align-self: flex-start;
  max-width: 190px;
  overflow: hidden;
  padding: 6px 9px;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stats,
.finance-grid,
.warehouse-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.stat {
  min-height: 88px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.stat.accent {
  background: var(--ink);
  color: #fff;
}

.stat span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.stat.accent span {
  color: #b7d8ff;
}

.stat strong {
  display: block;
  margin-top: 8px;
  font-size: 20px;
  line-height: 1.1;
}

.tabs {
  position: sticky;
  top: 82px;
  z-index: 9;
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding: 8px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow);
  backdrop-filter: blur(16px);
}

.tabs button {
  flex: 0 0 auto;
  min-width: 98px;
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 850;
}

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

.panel {
  margin-top: 14px;
}

.toolbar {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  margin-bottom: 12px;
}

.input,
.select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 13px;
  background: var(--panel);
  color: var(--ink);
  outline: none;
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.form-title {
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.form-title b,
.form-title span {
  display: block;
}

.form-title span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.movement-split {
  align-items: start;
}

.import-panel {
  margin-bottom: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.import-form {
  display: grid;
  grid-template-columns: minmax(180px, 0.8fr) minmax(240px, 1.4fr) auto;
  gap: 8px;
}

.file-input {
  padding-top: 11px;
}

.import-preview {
  display: grid;
  gap: 10px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.import-lines {
  display: grid;
  gap: 5px;
  max-height: 420px;
  overflow: auto;
  padding-right: 2px;
}

.import-lines div,
.sync-checkbox {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  padding: 7px 9px;
  border-radius: 7px;
  background: var(--soft);
  color: var(--ink);
  font-size: 13px;
}

.import-lines div.needs-check {
  border: 1px solid rgba(168, 85, 247, 0.36);
  background: rgba(124, 58, 237, 0.12);
}

.import-lines span {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.import-lines strong,
.import-lines small,
.import-lines em {
  display: block;
}

.import-lines strong {
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
}

.import-lines small,
.import-lines em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  line-height: 1.3;
}

.sync-checkbox {
  justify-content: flex-start;
  align-items: center;
}

.sync-checkbox input {
  width: 18px;
  height: 18px;
}

.import-confirm:disabled {
  opacity: 0.62;
}

.issue-cart-list {
  display: grid;
  gap: 6px;
}

.issue-cart-list > div {
  display: grid;
  grid-template-columns: 1fr auto 34px;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 7px;
  background: var(--soft);
  font-size: 13px;
}

.icon-remove {
  min-height: 32px;
  width: 32px;
  padding: 0;
  font-size: 18px;
}

.invite-create-form {
  max-width: 520px;
}

.invite-list-head {
  margin-top: 18px;
}

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

.invite-row {
  display: grid;
  grid-template-columns: 110px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.invite-row.used {
  opacity: 0.62;
}

.invite-row code {
  color: var(--blue-dark);
  font-size: 20px;
  font-weight: 900;
}

.invite-row span:not(.pill) {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.access-form {
  max-width: 560px;
  margin: 24px auto;
}

.code-input {
  font-size: 24px;
  font-weight: 900;
  letter-spacing: 0;
}

.access-waiting {
  max-width: 560px;
  margin: 24px auto;
  padding: 40px 22px;
}

.curator-team-card {
  display: grid;
  gap: 12px;
}

.settings-section {
  margin-bottom: 18px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.system-checks {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.system-check {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  padding: 10px;
  border-radius: 8px;
  background: var(--soft);
}

.system-check > span {
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  width: 28px;
  height: 28px;
  border-radius: 7px;
  color: #fff;
  font-weight: 900;
}

.system-check.ok > span {
  background: var(--ok);
}

.system-check.bad > span {
  background: var(--danger);
}

.system-check b,
.system-check small {
  display: block;
  overflow-wrap: anywhere;
}

.system-check small {
  margin-top: 3px;
  color: var(--muted);
}

.settings-metrics,
.settings-actions {
  margin-top: 12px;
}

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

.settings-actions button {
  flex: 1 1 210px;
}

.settings-actions button:disabled {
  opacity: 0.62;
  cursor: wait;
}

.sync-result {
  margin-top: 12px;
}

.category-rule-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 0.7fr) auto;
  gap: 8px;
}

.rule-list {
  display: grid;
  gap: 7px;
  margin-top: 10px;
}

.rule-row {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(110px, 0.5fr) auto;
  gap: 10px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--soft);
}

.cancel-sale-row {
  grid-template-columns: minmax(200px, 1.5fr) repeat(2, minmax(90px, 0.6fr)) auto;
}

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

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

.card,
.form,
.preview {
  padding: 14px;
}

.product-card {
  min-height: 154px;
}

.card-title {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-title strong {
  display: block;
  line-height: 1.25;
}

.card-title small {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.pill {
  flex: 0 0 auto;
  padding: 5px 9px;
  border-radius: 7px;
  background: var(--soft);
  color: var(--ink);
  font-size: 13px;
  font-weight: 850;
}

.pill.blue {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.pill.blocked {
  background: #fdeaea;
  color: var(--danger);
}

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

.metric-row.single {
  grid-template-columns: 1fr;
  margin-top: 12px;
}

.metric-row div {
  min-width: 0;
  padding: 10px;
  border-radius: 7px;
  background: var(--soft);
}

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

.metric-row b {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin: 4px 0 10px;
  color: var(--muted);
}

.section-head b {
  color: var(--ink);
  font-size: 16px;
}

.section-head > div b,
.section-head > div span {
  display: block;
}

.section-head > div span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(260px, 0.9fr);
  gap: 12px;
}

.form {
  display: grid;
  gap: 12px;
}

.preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 180px;
  background: var(--ink);
  color: #fff;
}

.preview span {
  color: #c6d2e2;
}

.primary,
.secondary,
.danger {
  min-height: 48px;
  border: 0;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 900;
}

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

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

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

.secondary.compact {
  min-width: 86px;
}

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

.empty {
  display: grid;
  gap: 6px;
  padding: 28px 16px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--soft);
  color: var(--muted);
  text-align: center;
}

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

.empty.slim {
  margin-top: 12px;
  text-align: left;
}

.timeline {
  display: grid;
  gap: 10px;
}

.event {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 14px;
}

.event-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-weight: 950;
}

.event-icon.payment {
  background: var(--ink);
}

.event-icon.return {
  background: var(--muted);
}

.event-icon.audit {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.event-icon.stock {
  background: var(--ok);
}

.warehouse-summary {
  margin-top: 0;
  margin-bottom: 12px;
}

.operation-warning {
  padding: 10px 12px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 750;
}

.warehouse-head {
  margin-top: 18px;
}

.warehouse-head .input {
  max-width: 360px;
}

.warehouse-table {
  display: grid;
  gap: 8px;
}

.period-switch {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 7px;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.period-switch button {
  min-height: 42px;
  border: 0;
  border-radius: 7px;
  background: var(--soft);
  color: var(--muted);
  font-weight: 850;
}

.period-switch button.active {
  background: var(--ink);
  color: #fff;
}

.finance-period-label {
  margin: 14px 0 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.finance-section {
  margin-top: 18px;
}

.ledger-explanation {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 13px 14px;
  border-left: 3px solid var(--blue);
  background: var(--soft);
}

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

.ledger-explanation span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

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

.compact-metrics > div {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.compact-metrics span,
.finance-row span,
.finance-group-title span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.compact-metrics b {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
}

.compact-metrics .total {
  background: var(--ink);
  color: #fff;
}

.compact-metrics .total span {
  color: #b7d8ff;
}

.compact-metrics .debt {
  border-color: #f1c7c7;
  background: #fff2f2;
  color: var(--danger);
}

.compact-metrics .ok {
  border-color: #bfe8d2;
  background: #effaf4;
  color: var(--ok);
}

.finance-list,
.finance-groups {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.finance-row,
.finance-group {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.finance-row {
  display: grid;
  grid-template-columns: minmax(200px, 1.5fr) repeat(2, minmax(110px, 0.7fr));
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
}

.debt-reminder-row {
  grid-template-columns: minmax(180px, 1.4fr) repeat(2, minmax(100px, 0.6fr)) auto;
}

.finance-row > div:not(:first-child) {
  text-align: right;
}

.finance-row b {
  display: block;
  margin-top: 3px;
}

.money-due b {
  color: var(--danger);
}

.finance-group {
  padding: 14px;
}

.finance-group-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.finance-group-title strong {
  color: var(--blue-dark);
  white-space: nowrap;
}

.compact-metrics.mini {
  margin-top: 12px;
}

.seller-breakdown {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.seller-breakdown div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
}

.stock-disclosure {
  margin-top: 10px;
  border-top: 1px solid var(--line);
}

.stock-disclosure summary {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 0 3px;
  color: var(--blue-dark);
  font-size: 13px;
  font-weight: 800;
  cursor: pointer;
}

.stock-disclosure summary span {
  color: var(--muted);
  white-space: nowrap;
}

.stock-detail-list {
  display: grid;
  gap: 1px;
  margin-top: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.stock-detail-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  gap: 12px;
  padding: 9px 10px;
  background: var(--soft);
  font-size: 12px;
}

.stock-detail-list > div + div {
  border-top: 1px solid var(--line);
}

.stock-detail-list span {
  grid-column: 1;
  min-width: 0;
  overflow-wrap: anywhere;
}

.stock-detail-list small {
  grid-column: 1;
  color: var(--muted);
  line-height: 1.35;
}

.stock-detail-list b {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  text-align: right;
  white-space: nowrap;
}

.stock-detail-list p {
  margin: 0;
  padding: 10px;
  color: var(--muted);
  background: var(--soft);
}

.seller-breakdown span {
  color: var(--muted);
}

.settlement-section {
  padding: 14px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--blue);
  border-radius: 8px;
  background: var(--panel);
}

.transfer-form {
  display: grid;
  grid-template-columns: minmax(150px, 0.7fr) minmax(220px, 1.2fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 12px;
}

.settlement-ok {
  margin-top: 12px;
  border-left-color: var(--ok);
  background: #effaf4;
  color: var(--ok);
}

.overdue-note {
  margin-top: 10px;
  border-left-color: var(--danger);
  background: #fff2f2;
  color: var(--danger);
}

.incoming-transfers {
  display: grid;
  gap: 8px;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.transfer-review {
  display: grid;
  grid-template-columns: minmax(160px, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--soft);
}

.transfer-review span {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.transfer-review > strong {
  color: var(--blue-dark);
}

.transfer-actions {
  display: flex;
  gap: 6px;
}

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

.warehouse-row {
  display: grid;
  grid-template-columns: minmax(230px, 2fr) repeat(6, minmax(78px, 0.7fr));
  gap: 10px;
  align-items: center;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.warehouse-row > div:not(.warehouse-product) {
  text-align: right;
}

.warehouse-row span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 750;
}

.warehouse-row b {
  display: block;
  margin-top: 3px;
  overflow-wrap: anywhere;
}

.event-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  line-height: 1.25;
}

.event-title strong {
  color: var(--blue-dark);
  white-space: nowrap;
}

.event-meta,
.event-details {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.event-meta span,
.event-details span {
  padding: 4px 7px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.event-details span {
  color: var(--ink);
}

.user-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.user-card span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.user-card code {
  padding: 6px 8px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 850;
}

.user-manage-card {
  display: grid;
  gap: 12px;
}

.user-manage-head,
.user-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.user-manage-head span:not(.pill) {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.user-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.user-controls .input,
.user-controls .select {
  min-height: 42px;
}

.muted-field {
  opacity: 0.52;
}

.user-actions button {
  flex: 1;
}

.admin-user-card {
  grid-column: 1 / -1;
}

.toast {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: calc(14px + env(safe-area-inset-bottom));
  z-index: 20;
  display: none;
  max-width: 980px;
  margin: 0 auto;
  padding: 13px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  box-shadow: var(--shadow);
}

.toast.show {
  display: block;
}

.hidden {
  display: none !important;
}

@media (max-width: 720px) {
  .stats,
  .finance-grid,
  .warehouse-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

  .tabs {
    top: 76px;
  }

  h1 {
    font-size: 24px;
  }

  .event-title {
    display: grid;
  }

  .warehouse-head {
    display: grid;
  }

  .warehouse-head .input {
    max-width: none;
  }

  .warehouse-row {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

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

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

  .finance-row > div:first-child {
    grid-column: 1 / -1;
  }

  .finance-row > div:not(:first-child) {
    text-align: left;
    padding: 8px;
    background: var(--soft);
    border-radius: 7px;
  }

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

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

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

  .transfer-actions button {
    flex: 1;
  }

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

  .system-checks {
    grid-template-columns: 1fr;
  }

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

  .category-rule-form,
  .rule-row {
    grid-template-columns: 1fr;
  }

  .cancel-sale-row > button {
    grid-column: 1 / -1;
  }

  .invite-row code {
    grid-column: 1 / -1;
  }

  .warehouse-product {
    grid-column: 1 / -1;
  }

  .warehouse-row > div:not(.warehouse-product) {
    text-align: left;
    padding: 8px;
    background: var(--soft);
    border-radius: 7px;
  }
}

@media (max-width: 420px) {
  .app {
    padding: 10px;
  }

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

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

  .tabs button {
    min-width: 92px;
  }

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

  .section-head {
    display: grid;
    justify-content: stretch;
  }

  .stat {
    min-height: 82px;
    padding: 12px;
  }

  .stat strong {
    font-size: 18px;
  }
}

/* Simplified v2 shell */
body {
  background: #f5f7fa;
}

.app {
  max-width: 860px;
  padding-bottom: calc(104px + env(safe-area-inset-bottom));
}

.topbar {
  padding: 12px 0 10px;
  background: rgba(245, 247, 250, 0.94);
}

.eyebrow {
  display: none;
}

.profile {
  padding: 11px 13px;
  box-shadow: none;
}

.status {
  max-width: 136px;
  padding: 5px 8px;
  font-size: 10px;
}

.stats {
  display: none;
}

.home-screen .stats {
  display: grid;
}

.stat,
.card,
.form,
.preview,
.event {
  box-shadow: 0 8px 24px rgba(8, 26, 52, 0.06);
}

.tabs {
  position: fixed;
  top: auto;
  left: 50%;
  right: auto;
  bottom: calc(10px + env(safe-area-inset-bottom));
  z-index: 30;
  width: min(calc(100% - 20px), 620px);
  margin: 0;
  padding: 6px;
  transform: translateX(-50%);
  overflow: visible;
  border-color: #d7e0eb;
  box-shadow: 0 14px 36px rgba(7, 17, 31, 0.18);
}

.tabs button {
  display: grid;
  place-items: center;
  flex: 1 1 0;
  min-width: 0;
  min-height: 54px;
  gap: 2px;
  padding: 5px 3px;
  font-size: 11px;
  font-weight: 800;
}

.tabs button.active {
  background: var(--ink);
}

.nav-icon {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
}

.nav-icon svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
}

.category-tabs {
  display: flex;
  gap: 7px;
  margin-bottom: 11px;
  padding-bottom: 2px;
  overflow-x: auto;
  scrollbar-width: none;
}

.category-tabs::-webkit-scrollbar {
  display: none;
}

.category-tabs button {
  flex: 0 0 auto;
  min-height: 38px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 800;
}

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

.product-group {
  margin-bottom: 18px;
}

.group-title {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 9px;
}

.group-title b {
  font-size: 18px;
  text-transform: capitalize;
}

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

.import-groups {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.import-groups span {
  padding: 6px 9px;
  border-radius: 7px;
  background: var(--blue-soft);
  color: var(--blue-dark);
  font-size: 12px;
}

.panel {
  margin-top: 12px;
}

.welcome {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin: 4px 0 14px;
}

.welcome span,
.simple-note span {
  color: var(--muted);
  font-size: 13px;
}

.welcome h2 {
  max-width: 560px;
  margin: 5px 0 0;
  font-size: 24px;
  line-height: 1.15;
}

.text-action {
  flex: 0 0 auto;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--blue-dark);
  font-weight: 850;
}

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

.action-tile {
  position: relative;
  display: grid;
  min-height: 126px;
  padding: 17px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.action-tile span {
  align-self: end;
  font-size: 18px;
  font-weight: 900;
}

.action-tile small {
  align-self: start;
  margin-top: 5px;
  color: var(--muted);
  font-size: 13px;
}

.action-tile > b {
  position: absolute;
  top: 14px;
  right: 15px;
  color: var(--blue);
  font-size: 22px;
}

.action-tile.primary-tile {
  border-color: var(--blue);
  background: var(--blue);
  color: #fff;
}

.action-tile.primary-tile small,
.action-tile.primary-tile > b {
  color: #dcecff;
}

.simple-note {
  display: grid;
  gap: 5px;
  margin-top: 12px;
  padding: 14px;
  border-left: 3px solid var(--blue);
  background: var(--blue-soft);
}

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

.more-list > button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  min-height: 72px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  text-align: left;
}

.more-list b,
.more-list span {
  display: block;
}

.more-list span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.more-list strong {
  color: var(--blue);
  font-size: 22px;
}

.issue-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 0.65fr);
  gap: 12px;
  align-items: start;
}

.issue-recipient {
  grid-column: 1 / -1;
}

.issue-catalog {
  min-width: 0;
}

.issue-picker {
  display: grid;
  gap: 7px;
  max-height: 590px;
  margin-top: 9px;
  overflow-y: auto;
}

.issue-product {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.issue-product b,
.issue-product span {
  display: block;
}

.issue-product span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.issue-product > button,
.cart-stepper button {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  font-size: 24px;
  font-weight: 900;
}

.issue-product > button:disabled {
  background: var(--line);
  color: var(--muted);
}

.issue-cart-panel {
  position: sticky;
  top: 78px;
}

.issue-cart-list > div {
  grid-template-columns: minmax(0, 1fr) auto;
}

.cart-stepper {
  display: grid;
  grid-template-columns: 32px 34px 32px;
  align-items: center;
  text-align: center;
}

.cart-stepper button {
  width: 32px;
  height: 32px;
  background: var(--ink);
  font-size: 18px;
}

.advanced-box {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.advanced-box summary {
  padding: 14px;
  cursor: pointer;
  font-weight: 850;
}

.embedded-form {
  border: 0;
  border-top: 1px solid var(--line);
  box-shadow: none;
}

.inventory-note {
  margin-top: 0;
  margin-bottom: 12px;
}

.inventory-list {
  display: grid;
  gap: 7px;
  padding-bottom: 88px;
}

.inventory-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 12px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.inventory-row.changed {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.inventory-row b,
.inventory-row span {
  display: block;
}

.inventory-row span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.inventory-row .input {
  min-height: 42px;
  text-align: center;
  font-weight: 900;
}

.inventory-submit {
  position: fixed;
  left: 50%;
  bottom: calc(84px + env(safe-area-inset-bottom));
  z-index: 25;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  width: min(calc(100% - 28px), 832px);
  padding: 8px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 32px rgba(7, 17, 31, 0.16);
  backdrop-filter: blur(16px);
}

@media (max-width: 520px) {
  .app {
    padding: 10px 10px calc(98px + env(safe-area-inset-bottom));
  }

  .topbar {
    position: static;
  }

  .profile {
    margin-bottom: 2px;
  }

  .home-screen .stats {
    gap: 8px;
    margin-top: 9px;
  }

  .home-screen .stat {
    min-height: 72px;
    padding: 11px;
  }

  .home-screen .stat strong {
    margin-top: 6px;
    font-size: 17px;
  }

  .welcome {
    align-items: start;
    margin-top: 10px;
  }

  .welcome h2 {
    font-size: 21px;
  }

  .action-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .action-tile {
    min-height: 86px;
    padding: 14px;
  }

  .tabs {
    width: calc(100% - 16px);
    bottom: calc(8px + env(safe-area-inset-bottom));
  }

  .issue-workspace {
    grid-template-columns: 1fr;
  }

  .issue-recipient {
    grid-column: auto;
  }

  .issue-cart-panel {
    position: static;
  }

  .issue-picker {
    max-height: none;
  }

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

  .inventory-submit {
    grid-template-columns: 1fr;
    bottom: calc(78px + env(safe-area-inset-bottom));
  }
}

/* Apple Store inspired refresh */
:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --ink: #111111;
  --muted: #6e6e73;
  --line: #e5e5ea;
  --soft: #f8f8fa;
  --blue: #ff7a00;
  --blue-dark: #c45100;
  --blue-soft: #fff3e7;
  --danger: #d92d20;
  --ok: #1d7f45;
  --shadow: 0 12px 34px rgba(0, 0, 0, 0.07);
}

body {
  background:
    radial-gradient(circle at 50% -120px, rgba(255, 122, 0, 0.10), transparent 300px),
    var(--bg);
  color: var(--ink);
}

.app {
  max-width: 920px;
}

.topbar {
  background: rgba(245, 245, 247, 0.86);
  border-bottom: 1px solid rgba(229, 229, 234, 0.72);
}

h1 {
  font-size: 30px;
  font-weight: 800;
}

.profile,
.stat,
.card,
.form,
.preview,
.event,
.import-panel,
.settings-section,
.finance-row,
.finance-group,
.warehouse-row,
.more-list > button,
.action-tile,
.advanced-box,
.inventory-row,
.period-switch,
.compact-metrics > div {
  border-color: rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.045);
}

.profile,
.card,
.form,
.event,
.import-panel,
.settings-section,
.finance-row,
.finance-group,
.warehouse-row,
.more-list > button,
.action-tile,
.advanced-box,
.inventory-row,
.period-switch,
.compact-metrics > div {
  background: rgba(255, 255, 255, 0.96);
}

.status,
.pill.blue,
.event-icon.audit,
.category-tabs button.active,
.primary,
.action-tile.primary-tile,
.issue-product > button,
.issue-inline-stepper button:not(:disabled),
.operation-warning,
.ledger-explanation,
.simple-note,
.import-groups span {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.primary,
.action-tile.primary-tile,
.tabs button.active,
.issue-product > button,
.issue-inline-stepper button:not(:disabled) {
  background: var(--ink);
  color: #fff;
}

.primary:hover {
  background: #2b2b2f;
}

.secondary,
.preview,
.stat.accent,
.compact-metrics .total,
.period-switch button.active {
  background: var(--ink);
  color: #fff;
}

.preview {
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.14);
}

.preview span,
.stat.accent span,
.compact-metrics .total span {
  color: #d2d2d7;
}

.tabs {
  border-color: rgba(0, 0, 0, 0.08);
  background: rgba(255, 255, 255, 0.88);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.16);
}

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

.input,
.select {
  border-color: rgba(0, 0, 0, 0.10);
  background: #fbfbfd;
}

.input:focus,
.select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(255, 122, 0, 0.14);
}

.text-action,
.action-tile > b,
.more-list strong,
.event-title strong,
.finance-group-title strong,
.stock-disclosure summary {
  color: var(--blue-dark);
}

.action-tile.primary-tile small,
.action-tile.primary-tile > b {
  color: #ffcf99;
}

.simple-note,
.ledger-explanation,
.operation-warning,
.settlement-section {
  border-left-color: var(--blue);
}

.event-icon {
  background: var(--ink);
}

.event-icon.stock {
  background: var(--blue);
}

.event-icon.payment {
  background: #2b2b2f;
}

.issue-product {
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: 72px;
}

.issue-inline-stepper {
  display: grid;
  grid-template-columns: 34px 38px 34px;
  align-items: center;
  text-align: center;
}

.issue-inline-stepper button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 8px;
  background: #eeeeef;
  color: var(--muted);
  font-size: 18px;
  font-weight: 900;
}

.issue-inline-stepper strong {
  color: var(--ink);
  font-weight: 900;
}

.pos-scan-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  margin-bottom: 9px;
}

.sale-cart-list {
  display: grid;
  gap: 8px;
}

.sale-cart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 92px auto;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 8px;
  background: var(--soft);
}

.sale-cart-row b,
.sale-cart-row span {
  display: block;
}

.sale-cart-row span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.sale-cart-row .input {
  min-height: 38px;
  text-align: center;
  font-weight: 850;
}

.product-history-btn {
  width: 100%;
  margin-top: 10px;
}

.product-timeline-stock {
  margin-bottom: 14px;
}

.insights-panel {
  margin-top: 14px;
}

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

.insight-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.045);
}

.insight-card span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.insight-card b {
  display: block;
  margin-top: 5px;
  font-size: 18px;
}

.insight-card ul {
  display: grid;
  gap: 5px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
}

.insight-card li,
.insight-card p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.cart-stepper button {
  background: #2b2b2f;
}

.control-hero,
.control-section {
  margin-bottom: 14px;
  padding: 16px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.045);
}

.control-hero {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.control-hero span,
.holder-head span,
.inline-price-form > span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.control-hero h2 {
  margin: 4px 0 0;
  font-size: 22px;
  letter-spacing: 0;
}

.control-summary {
  margin-bottom: 14px;
}

.control-search {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
  padding: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: #fff;
}

.search-result-list,
.alert-list {
  display: grid;
  gap: 8px;
}

.search-result-list article,
.alert-card {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 12px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: var(--soft);
  color: var(--text);
  text-align: left;
}

.search-result-list span,
.search-result-list small,
.alert-card span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.alert-card.warning {
  border-color: rgba(255, 122, 26, 0.34);
  background: rgba(255, 122, 26, 0.08);
}

.alert-card.danger {
  border-color: rgba(220, 38, 38, 0.26);
  background: rgba(220, 38, 38, 0.07);
}

.alert-card.info {
  border-color: rgba(0, 0, 0, 0.08);
}

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

.holder-card {
  min-width: 0;
  padding: 14px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 8px;
  background: var(--soft);
}

.holder-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.holder-head b,
.holder-head strong {
  font-size: 16px;
}

.inline-price-form {
  display: grid;
  gap: 6px;
  min-width: 150px;
}

.inline-price-form > div {
  display: grid;
  grid-template-columns: minmax(72px, 1fr) auto;
  gap: 6px;
  align-items: center;
}

.inline-price-form .input {
  min-height: 36px;
  padding: 8px;
  text-align: center;
  font-weight: 850;
}

.inline-price-form .compact-action {
  min-height: 36px;
  padding: 0 10px;
}

.empty {
  border-color: rgba(0, 0, 0, 0.10);
  background: #fbfbfd;
}

@media (max-width: 520px) {
  h1 {
    font-size: 26px;
  }

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

  .issue-inline-stepper {
    justify-self: stretch;
    grid-template-columns: 42px 1fr 42px;
    padding-top: 4px;
  }

  .issue-inline-stepper button {
    width: 42px;
    height: 38px;
  }

  .pos-scan-row,
  .sale-cart-row,
  .insight-grid,
  .control-hero {
    grid-template-columns: 1fr;
  }

  .control-hero {
    display: grid;
  }

  .sale-cart-row .cart-stepper {
    grid-template-columns: 42px 1fr 42px;
  }
}

/* iOS 27 concept layer: liquid glass, calm density, black/orange identity */
:root {
  --bg: #f6f7fb;
  --panel: rgba(255, 255, 255, 0.78);
  --ink: #08080a;
  --muted: #73737b;
  --line: rgba(20, 20, 24, 0.10);
  --soft: rgba(255, 255, 255, 0.56);
  --blue: #ff8a1f;
  --blue-dark: #a64000;
  --blue-soft: rgba(255, 138, 31, 0.13);
  --danger: #d92d20;
  --ok: #16874d;
  --shadow: 0 18px 48px rgba(16, 18, 27, 0.09);
  --glass: saturate(1.45) blur(28px);
  --glass-border: rgba(255, 255, 255, 0.64);
  --radius: 20px;
  --radius-small: 14px;
}

body {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96) 0, rgba(246, 247, 251, 0.94) 38%, #eef0f6 100%);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}

.app {
  max-width: 960px;
  padding: 18px;
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
}

.topbar {
  top: 0;
  margin: -18px -18px 0;
  padding: calc(18px + env(safe-area-inset-top)) 18px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.56);
  background: rgba(246, 247, 251, 0.72);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}

.eyebrow {
  color: var(--blue-dark);
  font-size: 11px;
  letter-spacing: 0;
}

h1 {
  font-size: 31px;
  font-weight: 860;
  line-height: 1;
}

.icon-btn,
.tabs,
.profile,
.stat,
.card,
.form,
.preview,
.event,
.import-panel,
.settings-section,
.finance-row,
.finance-group,
.warehouse-row,
.more-list > button,
.action-tile,
.advanced-box,
.inventory-row,
.period-switch,
.compact-metrics > div,
.control-hero,
.control-section,
.control-search,
.insight-card,
.holder-card,
.search-result-list article,
.alert-card {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.72),
    0 18px 48px rgba(16, 18, 27, 0.085);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}

.card,
.finance-row,
.warehouse-row,
.more-list > button,
.action-tile,
.inventory-row,
.holder-card,
.search-result-list article,
.alert-card,
.compact-metrics > div,
.system-check,
.rule-row,
.issue-cart-list > div,
.sale-cart-row {
  border-radius: var(--radius-small);
}

.profile {
  margin-top: 12px;
  padding: 16px;
}

.status,
.pill {
  border-radius: 999px;
}

.stat {
  min-height: 92px;
  padding: 16px;
}

.stat.accent,
.primary,
.tabs button.active,
.action-tile.primary-tile,
.issue-product > button,
.issue-inline-stepper button:not(:disabled),
.cart-stepper button,
.secondary,
.preview,
.compact-metrics .total,
.period-switch button.active {
  background:
    linear-gradient(180deg, rgba(31, 31, 35, 0.98), rgba(5, 5, 7, 0.98));
  color: #fff;
}

.primary,
.secondary,
.danger,
.text-action,
.compact-action,
.tabs button,
.action-tile,
.more-list > button,
.category-tabs button,
.period-switch button,
.issue-inline-stepper button,
.cart-stepper button {
  transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease, opacity 160ms ease;
}

.primary:active,
.secondary:active,
.danger:active,
.tabs button:active,
.action-tile:active,
.more-list > button:active,
.issue-inline-stepper button:active,
.cart-stepper button:active {
  transform: scale(0.985);
}

.tabs {
  position: fixed;
  left: max(14px, env(safe-area-inset-left));
  right: max(14px, env(safe-area-inset-right));
  bottom: max(12px, env(safe-area-inset-bottom));
  top: auto;
  z-index: 30;
  max-width: 620px;
  margin: 0 auto;
  padding: 8px;
  justify-content: space-between;
  border-radius: 28px;
  background: rgba(250, 250, 252, 0.72);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.82),
    0 24px 70px rgba(14, 15, 20, 0.20);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}

.tabs button {
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 0;
  flex: 1 1 0;
  min-height: 54px;
  border-radius: 22px;
  font-size: 11px;
  font-weight: 850;
}

.nav-icon {
  width: 22px;
  height: 22px;
}

.tabs button.active {
  box-shadow: 0 10px 28px rgba(8, 8, 10, 0.22);
}

.input,
.select {
  min-height: 50px;
  border-color: rgba(20, 20, 24, 0.10);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.input:focus,
.select:focus {
  border-color: rgba(255, 138, 31, 0.54);
  box-shadow:
    0 0 0 5px rgba(255, 138, 31, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.86);
}

.welcome,
.control-hero {
  background:
    linear-gradient(135deg, rgba(255, 255, 255, 0.86), rgba(255, 246, 237, 0.72));
}

.action-tile {
  min-height: 118px;
}

.action-tile.primary-tile {
  border-color: rgba(255, 138, 31, 0.40);
  background:
    linear-gradient(135deg, rgba(10, 10, 12, 0.98), rgba(42, 35, 28, 0.98));
}

.action-tile.primary-tile span {
  color: #fff;
}

.action-tile.primary-tile small,
.action-tile.primary-tile > b {
  color: #ffd6ad;
}

.category-tabs {
  padding-bottom: 4px;
}

.category-tabs button,
.period-switch button {
  border-radius: 999px;
}

.category-tabs button.active,
.status,
.pill.blue,
.event-icon.stock,
.operation-warning,
.ledger-explanation,
.simple-note,
.import-groups span {
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.simple-note,
.ledger-explanation,
.operation-warning,
.settlement-section {
  border-left: 0;
  border-top: 3px solid rgba(255, 138, 31, 0.42);
}

.issue-product {
  border-radius: var(--radius);
}

.issue-inline-stepper,
.cart-stepper {
  border-radius: 999px;
  background: rgba(245, 245, 247, 0.72);
}

.issue-inline-stepper button,
.cart-stepper button {
  border-radius: 999px;
}

.empty {
  border-color: rgba(255, 255, 255, 0.64);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.68);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}

.toast {
  bottom: calc(92px + env(safe-area-inset-bottom));
  border-radius: 999px;
  background: rgba(8, 8, 10, 0.86);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}

@media (min-width: 760px) {
  .tabs {
    left: 50%;
    right: auto;
    width: 620px;
    transform: translateX(-50%);
  }
}

@media (max-width: 520px) {
  .app {
    padding: 14px;
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }

  .topbar {
    margin: -14px -14px 0;
    padding-left: 14px;
    padding-right: 14px;
  }

  h1 {
    font-size: 28px;
  }

  .tabs {
    left: 10px;
    right: 10px;
    padding: 7px;
  }

  .tabs button {
    min-height: 52px;
    border-radius: 20px;
  }
}

/* Apple Store direct layer: clean retail layout, white cards, quiet hierarchy */
:root {
  --bg: #f5f5f7;
  --panel: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #d2d2d7;
  --soft: #fbfbfd;
  --blue: #ff7a1a;
  --blue-dark: #bf4b00;
  --blue-soft: #fff4ea;
  --danger: #d70015;
  --ok: #008a43;
  --shadow: none;
  --glass: none;
  --glass-border: #e5e5ea;
  --radius: 18px;
  --radius-small: 14px;
}

body {
  background: var(--bg);
  color: var(--ink);
}

.app {
  max-width: 1180px;
  padding: 24px;
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
}

.topbar {
  margin: -24px -24px 0;
  padding: calc(18px + env(safe-area-inset-top)) 24px 16px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  background: rgba(245, 245, 247, 0.92);
  backdrop-filter: saturate(1.8) blur(20px);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
}

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: none;
}

h1 {
  font-size: 40px;
  font-weight: 760;
  line-height: 1.05;
}

.icon-btn {
  border: 0;
  border-radius: 999px;
  background: #1d1d1f;
  color: #fff;
}

.profile,
.stat,
.card,
.form,
.preview,
.event,
.import-panel,
.settings-section,
.finance-row,
.finance-group,
.warehouse-row,
.more-list > button,
.action-tile,
.advanced-box,
.inventory-row,
.period-switch,
.compact-metrics > div,
.control-hero,
.control-section,
.control-search,
.insight-card,
.holder-card,
.search-result-list article,
.alert-card {
  border: 0;
  border-radius: var(--radius);
  background: #ffffff;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.profile,
.settings-section,
.import-panel,
.control-section,
.control-search {
  border: 1px solid rgba(0, 0, 0, 0.04);
}

.stats,
.finance-grid,
.warehouse-summary {
  gap: 14px;
}

.stat {
  min-height: 112px;
  padding: 20px;
}

.stat span {
  font-size: 12px;
  font-weight: 700;
}

.stat strong {
  margin-top: 10px;
  font-size: 24px;
  font-weight: 760;
}

.stat.accent,
.primary,
.tabs button.active,
.action-tile.primary-tile,
.issue-product > button,
.issue-inline-stepper button:not(:disabled),
.cart-stepper button,
.secondary,
.preview,
.compact-metrics .total,
.period-switch button.active {
  background: #1d1d1f;
  color: #fff;
}

.secondary {
  background: #f5f5f7;
  color: #1d1d1f;
}

.primary,
.secondary,
.danger,
.compact-action {
  border-radius: 999px;
  min-height: 44px;
  font-weight: 760;
}

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

.tabs {
  left: 50%;
  right: auto;
  bottom: max(16px, env(safe-area-inset-bottom));
  width: min(680px, calc(100vw - 24px));
  max-width: 680px;
  transform: translateX(-50%);
  padding: 8px;
  border: 1px solid rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 16px 44px rgba(0, 0, 0, 0.13);
  backdrop-filter: saturate(1.8) blur(20px);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
}

.tabs button {
  min-height: 50px;
  border-radius: 999px;
  color: #6e6e73;
  font-size: 12px;
}

.tabs button.active {
  box-shadow: none;
}

.nav-icon {
  width: 21px;
  height: 21px;
}

.panel {
  margin-top: 18px;
}

.welcome,
.control-hero {
  min-height: 180px;
  padding: 28px;
  border-radius: 24px;
  background:
    linear-gradient(135deg, #ffffff 0%, #fff4ea 100%);
}

.welcome h2,
.control-hero h2 {
  max-width: 680px;
  font-size: 36px;
  font-weight: 780;
  line-height: 1.05;
}

.action-grid {
  gap: 14px;
}

.action-tile {
  min-height: 150px;
  padding: 22px;
  border-radius: 24px;
  background: #ffffff;
}

.action-tile span {
  font-size: 22px;
  font-weight: 780;
}

.action-tile small {
  margin-top: 8px;
  font-size: 14px;
  line-height: 1.35;
}

.action-tile.primary-tile {
  background:
    linear-gradient(135deg, #1d1d1f 0%, #3a2a1e 100%);
}

.action-tile.primary-tile small,
.action-tile.primary-tile > b {
  color: #ffd2ad;
}

.input,
.select {
  min-height: 48px;
  border: 1px solid #d2d2d7;
  border-radius: 12px;
  background: #ffffff;
  box-shadow: none;
}

.input:focus,
.select:focus {
  border-color: #ff7a1a;
  box-shadow: 0 0 0 4px rgba(255, 122, 26, 0.14);
}

.category-tabs button,
.period-switch button {
  border: 0;
  background: #ffffff;
  color: #6e6e73;
}

.category-tabs button.active,
.period-switch button.active {
  background: #1d1d1f;
  color: #ffffff;
}

.simple-note,
.ledger-explanation,
.operation-warning,
.settlement-section {
  border: 0;
  border-radius: var(--radius);
  background: #fff4ea;
  color: #7a3100;
}

.warehouse-row,
.finance-row,
.issue-product,
.inventory-row,
.holder-card,
.search-result-list article,
.alert-card {
  border: 1px solid rgba(0, 0, 0, 0.045);
}

.issue-product,
.sale-cart-row,
.issue-cart-list > div,
.rule-row,
.system-check,
.import-lines div,
.sync-checkbox {
  background: #f5f5f7;
}

.issue-inline-stepper,
.cart-stepper {
  background: #e8e8ed;
}

.issue-inline-stepper button,
.cart-stepper button {
  background: #1d1d1f;
  color: #fff;
}

.issue-inline-stepper button:disabled,
.cart-stepper button:disabled {
  background: #d2d2d7;
  color: #86868b;
}

.status,
.pill.blue,
.event-icon.stock,
.import-groups span {
  background: #fff4ea;
  color: #bf4b00;
}

.alert-card.warning {
  background: #fff4ea;
}

.alert-card.danger {
  background: #fff1f2;
}

.alert-card.info {
  background: #ffffff;
}

.empty {
  border: 0;
  border-radius: var(--radius);
  background: #ffffff;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}

.toast {
  bottom: calc(96px + env(safe-area-inset-bottom));
  background: rgba(29, 29, 31, 0.92);
  backdrop-filter: saturate(1.8) blur(20px);
  -webkit-backdrop-filter: saturate(1.8) blur(20px);
}

@media (max-width: 760px) {
  .app {
    padding: 16px;
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }

  .topbar {
    margin: -16px -16px 0;
    padding-left: 16px;
    padding-right: 16px;
  }

  h1 {
    font-size: 32px;
  }

  .welcome,
  .control-hero {
    min-height: 150px;
    padding: 22px;
  }

  .welcome h2,
  .control-hero h2 {
    font-size: 28px;
  }

  .action-tile {
    min-height: 126px;
  }

  .tabs {
    width: calc(100vw - 20px);
  }
}

/* Premium Dark Telegram Mini App UI design system */
:root {
  color-scheme: dark;
  --bg: #09090b;
  --bg-2: #101113;
  --panel: #15171a;
  --panel-raised: #1b1d22;
  --ink: #ffffff;
  --text: #ffffff;
  --muted: rgba(255, 255, 255, 0.72);
  --muted-2: rgba(255, 255, 255, 0.45);
  --line: rgba(255, 255, 255, 0.06);
  --soft: rgba(255, 255, 255, 0.055);
  --blue: #7c5cff;
  --blue-dark: #a78bfa;
  --blue-soft: rgba(124, 92, 255, 0.14);
  --indigo: #4f46e5;
  --violet: #a855f7;
  --electric: #38bdf8;
  --danger: #fb7185;
  --danger-soft: rgba(251, 113, 133, 0.12);
  --ok: #34d399;
  --ok-soft: rgba(52, 211, 153, 0.12);
  --warning: #fbbf24;
  --warning-soft: rgba(251, 191, 36, 0.12);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.42);
  --shadow-soft: 0 16px 46px rgba(0, 0, 0, 0.30);
  --glass: saturate(1.4) blur(24px);
  --glass-border: rgba(255, 255, 255, 0.08);
  --radius-button: 18px;
  --radius-input: 18px;
  --radius-card: 24px;
  --radius-modal: 28px;
  --radius-sheet: 32px;
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 20px;
  --space-6: 24px;
  --space-8: 32px;
  --space-10: 40px;
  --space-12: 48px;
  --space-16: 64px;
  --font-ui: Inter, Geist, Manrope, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", sans-serif;
}

* {
  -webkit-tap-highlight-color: transparent;
}

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

body {
  min-height: 100vh;
  background:
    radial-gradient(circle at 18% -8%, rgba(124, 92, 255, 0.20), transparent 34rem),
    radial-gradient(circle at 86% 4%, rgba(56, 189, 248, 0.13), transparent 30rem),
    linear-gradient(180deg, #09090b 0%, #0b0c10 44%, #09090b 100%);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  letter-spacing: 0;
}

button,
input,
select {
  font-family: var(--font-ui);
}

button,
.card,
.stat,
.action-tile,
.finance-row,
.warehouse-row,
.issue-product,
.inventory-row,
.holder-card,
.alert-card,
.more-list > button {
  transition: transform 220ms ease, border-color 220ms ease, background 220ms ease, box-shadow 220ms ease, opacity 220ms ease;
}

button:hover,
.action-tile:hover,
.more-list > button:hover,
.card:hover,
.issue-product:hover,
.finance-row:hover,
.warehouse-row:hover,
.holder-card:hover,
.alert-card:hover {
  transform: scale(1.02);
}

button:active,
.action-tile:active,
.more-list > button:active,
.card:active,
.issue-product:active,
.finance-row:active,
.warehouse-row:active,
.holder-card:active,
.alert-card:active {
  transform: scale(0.98);
}

.app {
  max-width: 1120px;
  padding: var(--space-5);
  padding-bottom: calc(112px + env(safe-area-inset-bottom));
  animation: premium-enter 280ms ease both;
}

.topbar {
  margin: calc(-1 * var(--space-5)) calc(-1 * var(--space-5)) 0;
  padding: calc(var(--space-5) + env(safe-area-inset-top)) var(--space-5) var(--space-4);
  border-bottom: 1px solid var(--line);
  background: rgba(9, 9, 11, 0.78);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}

.eyebrow {
  color: var(--blue-dark);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

h1 {
  color: var(--text);
  font-size: 36px;
  font-weight: 600;
  line-height: 1.04;
}

.profile,
.stat,
.card,
.form,
.preview,
.event,
.import-panel,
.settings-section,
.finance-row,
.finance-group,
.warehouse-row,
.more-list > button,
.action-tile,
.advanced-box,
.inventory-row,
.period-switch,
.compact-metrics > div,
.control-hero,
.control-section,
.control-search,
.insight-card,
.holder-card,
.search-result-list article,
.alert-card,
.empty {
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-card);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.030)),
    var(--panel);
  box-shadow: var(--shadow-soft);
  color: var(--text);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}

.profile,
.stat,
.card,
.action-tile,
.finance-row,
.warehouse-row,
.control-section,
.control-search,
.holder-card,
.insight-card {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.070), rgba(255, 255, 255, 0.035)),
    var(--panel);
}

.profile {
  margin-top: var(--space-4);
  padding: var(--space-4);
}

.profile span,
.card-title small,
.metric-row span,
.section-head span,
.compact-metrics span,
.finance-row span,
.finance-group-title span,
.event-meta,
.event-details,
.warehouse-row span,
.stock-detail-list small,
.simple-note span,
.action-tile small,
.more-list span,
.alert-card span,
.search-result-list span,
.search-result-list small {
  color: var(--muted);
}

.status,
.pill,
.import-groups span,
.category-tabs button,
.period-switch button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.status,
.pill.blue,
.category-tabs button.active,
.period-switch button.active {
  border-color: rgba(124, 92, 255, 0.26);
  background: var(--blue-soft);
  color: var(--blue-dark);
}

.pill.blocked,
.alert-card.danger,
.system-check.bad {
  background: var(--danger-soft);
  color: var(--danger);
}

.stats,
.finance-grid,
.warehouse-summary,
.action-grid,
.grid {
  gap: var(--space-4);
}

.stat {
  min-height: 108px;
  padding: var(--space-5);
}

.stat span {
  color: var(--muted-2);
  font-size: 12px;
  font-weight: 500;
}

.stat strong {
  margin-top: var(--space-3);
  color: var(--text);
  font-size: 22px;
  font-weight: 600;
}

.stat.accent,
.action-tile.primary-tile,
.preview,
.compact-metrics .total {
  border-color: rgba(124, 92, 255, 0.26);
  background:
    radial-gradient(circle at 20% 0%, rgba(56, 189, 248, 0.22), transparent 34%),
    linear-gradient(135deg, rgba(124, 92, 255, 0.36), rgba(79, 70, 229, 0.18)),
    var(--panel-raised);
  color: var(--text);
  box-shadow: 0 24px 90px rgba(79, 70, 229, 0.18);
}

.primary,
.secondary,
.danger,
.compact-action,
.icon-btn,
.text-action {
  border-radius: var(--radius-button);
  font-size: 14px;
  font-weight: 500;
}

.primary,
.tabs button.active,
.issue-product > button,
.issue-inline-stepper button:not(:disabled),
.cart-stepper button {
  border: 1px solid rgba(124, 92, 255, 0.38);
  background:
    linear-gradient(135deg, rgba(56, 189, 248, 0.22), transparent 42%),
    linear-gradient(135deg, var(--indigo), var(--violet));
  color: #ffffff;
  box-shadow: 0 14px 34px rgba(124, 92, 255, 0.24);
}

.secondary {
  border: 1px solid var(--line);
  background: var(--soft);
  color: var(--text);
}

.danger {
  border: 1px solid rgba(251, 113, 133, 0.24);
  background: var(--danger-soft);
  color: var(--danger);
}

.icon-btn {
  border: 1px solid var(--line);
  background: var(--panel-raised);
  color: var(--text);
}

.tabs {
  left: 50%;
  right: auto;
  bottom: max(var(--space-4), env(safe-area-inset-bottom));
  width: min(680px, calc(100vw - 24px));
  max-width: 680px;
  transform: translateX(-50%);
  padding: var(--space-2);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-sheet);
  background: rgba(21, 23, 26, 0.82);
  box-shadow: 0 24px 84px rgba(0, 0, 0, 0.52);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}

.tabs button {
  min-height: 54px;
  border-radius: 24px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.tabs button.active {
  color: #fff;
  transform: none;
}

.input,
.select {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: var(--radius-input);
  background: rgba(255, 255, 255, 0.045);
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.03);
}

.input::placeholder {
  color: var(--muted-2);
}

.select option {
  background: var(--bg-2);
  color: var(--text);
}

.input:focus,
.select:focus {
  border-color: rgba(124, 92, 255, 0.62);
  box-shadow: 0 0 0 4px rgba(124, 92, 255, 0.15);
}

.welcome,
.control-hero {
  min-height: 184px;
  padding: var(--space-8);
  border-radius: var(--radius-sheet);
  background:
    radial-gradient(circle at 12% 0%, rgba(56, 189, 248, 0.18), transparent 32%),
    radial-gradient(circle at 90% 0%, rgba(168, 85, 247, 0.20), transparent 30%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.070), rgba(255, 255, 255, 0.030)),
    var(--panel);
}

.welcome h2,
.control-hero h2 {
  max-width: 760px;
  color: var(--text);
  font-size: 36px;
  font-weight: 600;
  line-height: 1.06;
}

.action-tile {
  min-height: 148px;
  padding: var(--space-6);
}

.action-tile span,
.section-head b,
.finance-group-title b,
.card-title strong,
.holder-head b {
  color: var(--text);
  font-weight: 600;
}

.action-tile span {
  font-size: 22px;
}

.action-tile > b,
.text-action,
.more-list strong,
.event-title strong,
.finance-group-title strong,
.stock-disclosure summary {
  color: var(--blue-dark);
}

.category-tabs,
.period-switch {
  gap: var(--space-2);
}

.simple-note,
.ledger-explanation,
.operation-warning,
.settlement-section {
  border: 1px solid rgba(124, 92, 255, 0.15);
  border-radius: var(--radius-card);
  background: var(--blue-soft);
  color: var(--muted);
}

.issue-product,
.sale-cart-row,
.issue-cart-list > div,
.rule-row,
.system-check,
.import-lines div,
.sync-checkbox,
.stock-detail-list > div {
  background: rgba(255, 255, 255, 0.045);
}

.issue-inline-stepper,
.cart-stepper {
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.045);
}

.issue-inline-stepper button,
.cart-stepper button {
  border-radius: 999px;
}

.issue-inline-stepper button:disabled,
.cart-stepper button:disabled {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.055);
  color: var(--muted-2);
  box-shadow: none;
}

.event-icon {
  background: var(--panel-raised);
}

.event-icon.payment,
.event-icon.stock {
  background: linear-gradient(135deg, var(--indigo), var(--violet));
}

.event-icon.return,
.system-check.ok > span {
  background: var(--ok);
}

.system-check.bad > span {
  background: var(--danger);
}

.money-due b,
.compact-metrics .debt,
.compact-metrics .debt b {
  color: var(--danger);
}

.compact-metrics .ok,
.compact-metrics .ok b {
  color: var(--ok);
}

.alert-card.warning {
  border-color: rgba(251, 191, 36, 0.18);
  background: var(--warning-soft);
}

.alert-card.info {
  background: rgba(255, 255, 255, 0.045);
}

.empty {
  padding: var(--space-8);
  color: var(--muted);
}

.empty b {
  color: var(--text);
  font-weight: 600;
}

.toast {
  bottom: calc(96px + env(safe-area-inset-bottom));
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(27, 29, 34, 0.92);
  color: var(--text);
  box-shadow: var(--shadow);
  backdrop-filter: var(--glass);
  -webkit-backdrop-filter: var(--glass);
}

.panel > *,
.stats > *,
.action-grid > *,
.grid > *,
.finance-list > *,
.warehouse-table > *,
.timeline > *,
.control-section,
.control-search,
.import-panel,
.settings-section {
  animation: premium-rise 240ms ease both;
}

@keyframes premium-enter {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.99);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes premium-rise {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

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

@media (max-width: 760px) {
  .app {
    padding: var(--space-4);
    padding-bottom: calc(112px + env(safe-area-inset-bottom));
  }

  .topbar {
    margin: calc(-1 * var(--space-4)) calc(-1 * var(--space-4)) 0;
    padding-left: var(--space-4);
    padding-right: var(--space-4);
  }

  h1 {
    font-size: 28px;
  }

  .welcome,
  .control-hero {
    min-height: 156px;
    padding: var(--space-6);
  }

  .welcome h2,
  .control-hero h2 {
    font-size: 28px;
  }

  .action-tile {
    min-height: 128px;
  }

  .tabs {
    width: calc(100vw - 20px);
  }
}

/* Premium Dark Telegram Mini App UI: all screens pass */
.ui-icon,
.tile-icon,
.more-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.ui-icon svg,
.tile-icon svg,
.more-icon svg,
.tabs svg,
.refresh-btn svg {
  width: 18px;
  height: 18px;
}

.tile-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  width: 100%;
  margin-bottom: auto;
}

.tile-icon,
.more-icon {
  width: 44px;
  height: 44px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background:
    radial-gradient(circle at 25% 0%, rgba(56, 189, 248, 0.20), transparent 52%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  color: var(--text);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.primary-tile .tile-icon {
  border-color: rgba(124, 92, 255, 0.38);
  background: linear-gradient(135deg, var(--electric), var(--indigo), var(--violet));
  box-shadow: 0 16px 36px rgba(79, 70, 229, 0.25);
}

.tile-arrow,
.more-arrow {
  color: rgba(255, 255, 255, 0.48);
  font-weight: 500;
  transition: transform 200ms ease, color 200ms ease;
}

.action-tile:hover .tile-arrow,
.more-list button:hover .more-arrow {
  color: var(--text);
  transform: translateX(3px);
}

.more-list {
  display: grid;
  gap: var(--space-3);
}

.more-list button {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-4);
  min-height: 76px;
  padding: var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.065), rgba(255, 255, 255, 0.025)),
    var(--panel);
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow-soft);
  transition: transform 200ms ease, border-color 200ms ease, background 200ms ease;
}

.more-list button:hover {
  border-color: rgba(124, 92, 255, 0.30);
  transform: translateY(-1px) scale(1.01);
}

.more-list button:active {
  transform: scale(0.98);
}

.more-row-content {
  min-width: 0;
}

.more-row-content b,
.more-row-content span {
  display: block;
}

.more-row-content b {
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.more-row-content span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.skeleton-screen {
  display: grid;
  gap: var(--space-4);
}

.skeleton-kicker {
  color: var(--muted);
  font-size: 13px;
}

.skeleton-hero,
.skeleton-card {
  position: relative;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background: linear-gradient(110deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.085), rgba(255, 255, 255, 0.045));
}

.skeleton-hero {
  display: grid;
  align-content: end;
  gap: var(--space-3);
  min-height: 184px;
  padding: var(--space-6);
}

.skeleton-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--space-4);
}

.skeleton-card {
  min-height: 132px;
}

.skeleton-line {
  height: 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
}

.skeleton-line.wide {
  width: min(72%, 460px);
  height: 28px;
}

.skeleton-line.medium {
  width: min(56%, 360px);
}

.skeleton-line.short {
  width: 148px;
}

.skeleton-hero::after,
.skeleton-card::after {
  content: "";
  position: absolute;
  inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.10), transparent);
  animation: shimmer 1300ms infinite;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

.section-head,
.form-title,
.group-title,
.finance-group-title,
.holder-head,
.invite-list-head {
  align-items: flex-end;
  gap: var(--space-3);
}

.section-head span,
.form-title span,
.group-title span,
.finance-group-title span,
.holder-head span {
  color: var(--muted);
}

.toolbar,
.pos-scan-row,
.warehouse-controls,
.import-actions,
.settings-actions,
.user-controls,
.transfer-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.toolbar .input,
.toolbar .select,
.pos-scan-row .input {
  flex: 1;
  min-width: 0;
}

.finance-section,
.product-group,
.import-panel,
.settings-section,
.control-section,
.issue-catalog,
.issue-cart-panel,
.form,
.warehouse-summary,
.inventory-list,
.finance-group,
.transfer-review,
.incoming-transfers,
.invite-list,
.rule-list,
.alert-list,
.holder-list,
.search-result-list {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.058), rgba(255, 255, 255, 0.024)),
    var(--panel);
  box-shadow: var(--shadow-soft);
}

.issue-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(320px, 0.8fr);
  gap: var(--space-4);
  align-items: start;
}

.issue-catalog,
.issue-cart-panel,
.form {
  padding: var(--space-5);
}

.issue-picker,
.sale-cart-list,
.issue-cart-list,
.finance-list,
.warehouse-table,
.timeline,
.inventory-list,
.invite-list,
.rule-list,
.holder-list,
.alert-list {
  display: grid;
  gap: var(--space-3);
}

.issue-product,
.sale-cart-row,
.issue-cart-list > div,
.inventory-row,
.warehouse-row,
.finance-row,
.rule-row,
.invite-row,
.holder-card,
.alert-card,
.search-result-list button,
.stock-detail-list > div,
.seller-breakdown > div,
.import-lines div {
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 20px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.024)),
    rgba(255, 255, 255, 0.028);
  color: var(--text);
}

.issue-product,
.sale-cart-row,
.inventory-row,
.warehouse-row,
.finance-row,
.invite-row,
.rule-row,
.holder-card,
.alert-card,
.transfer-review {
  transition: transform 190ms ease, border-color 190ms ease, background 190ms ease;
}

.issue-product:hover,
.inventory-row:hover,
.warehouse-row:hover,
.finance-row:hover,
.invite-row:hover,
.rule-row:hover,
.holder-card:hover,
.alert-card:hover,
.transfer-review:hover {
  border-color: rgba(124, 92, 255, 0.20);
  transform: translateY(-1px);
}

.issue-product {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-4);
  align-items: center;
  padding: var(--space-4);
}

.issue-product b,
.warehouse-product b,
.finance-row b,
.inventory-row b,
.sale-cart-row b,
.event-title strong,
.product-card strong,
.user-card strong,
.user-manage-card strong {
  color: var(--text);
  font-weight: 600;
}

.issue-product span,
.warehouse-product span,
.finance-row span,
.inventory-row span,
.sale-cart-row span,
.event-title span,
.product-card small,
.user-card small,
.user-manage-card small {
  color: var(--muted);
}

.issue-inline-stepper,
.cart-stepper {
  min-width: 118px;
  min-height: 42px;
  padding: 4px;
  border-radius: 999px;
}

.issue-inline-stepper strong,
.cart-stepper b {
  min-width: 26px;
  text-align: center;
}

.sale-cart-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(94px, 128px) auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4);
}

.sale-cart-row .input {
  text-align: center;
}

.compact-metrics,
.finance-grid,
.control-summary,
.warehouse-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-3);
}

.compact-metrics > div,
.warehouse-summary > div,
.metric-row > div {
  min-width: 0;
  padding: var(--space-4);
  border: 1px solid rgba(255, 255, 255, 0.055);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.035);
}

.compact-metrics span,
.warehouse-summary span,
.metric-row span {
  color: var(--muted);
  font-size: 12px;
}

.compact-metrics b,
.warehouse-summary b,
.metric-row b {
  display: block;
  margin-top: 5px;
  color: var(--text);
  font-size: 16px;
  font-weight: 600;
}

.finance-period-label {
  margin: var(--space-4) 0 var(--space-3);
  color: var(--muted);
  font-size: 13px;
}

.finance-groups {
  display: grid;
  gap: var(--space-4);
}

.finance-group,
.finance-section,
.product-group,
.settings-section,
.control-section {
  padding: var(--space-5);
}

.finance-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(2, minmax(120px, auto)) auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4);
}

.finance-row.sale-finance-row {
  grid-template-columns: minmax(0, 1fr) repeat(2, minmax(110px, auto));
}

.finance-row > div {
  min-width: 0;
}

.stock-disclosure {
  margin-top: var(--space-3);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.032);
  overflow: hidden;
}

.stock-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-4);
  cursor: pointer;
}

.stock-detail-list {
  display: grid;
  gap: var(--space-2);
  padding: 0 var(--space-3) var(--space-3);
}

.stock-detail-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-2);
  padding: var(--space-3);
}

.stock-detail-list small {
  grid-column: 1 / -1;
  color: var(--muted-2);
}

.warehouse-row,
.inventory-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--space-3);
  align-items: center;
  padding: var(--space-4);
}

.warehouse-product {
  min-width: 0;
}

.warehouse-row .pill,
.product-card .pill,
.invite-row .pill {
  justify-self: start;
}

.product-card {
  display: grid;
  gap: var(--space-4);
}

.card-title,
.group-title,
.finance-group-title,
.holder-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
}

.metric-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-3);
}

.timeline {
  position: relative;
}

.event {
  border: 1px solid var(--line);
  border-radius: var(--radius-card);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.055), rgba(255, 255, 255, 0.022)),
    var(--panel);
  box-shadow: var(--shadow-soft);
}

.event-icon {
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

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

.settings-actions button,
.transfer-actions button,
.user-actions button {
  white-space: nowrap;
}

.empty {
  display: grid;
  place-items: center;
  min-height: 164px;
  text-align: center;
}

.empty.slim {
  min-height: 92px;
}

.empty::before {
  content: "";
  width: 46px;
  height: 46px;
  margin-bottom: var(--space-3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background:
    radial-gradient(circle at 30% 0%, rgba(56, 189, 248, 0.16), transparent 58%),
    linear-gradient(145deg, rgba(255, 255, 255, 0.09), rgba(255, 255, 255, 0.025));
}

.empty b,
.empty span {
  display: block;
}

.empty span {
  margin-top: 6px;
}

.period-switch,
.category-tabs {
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.period-switch::-webkit-scrollbar,
.category-tabs::-webkit-scrollbar {
  display: none;
}

.period-switch button,
.category-tabs button {
  flex: 0 0 auto;
}

.file-input {
  padding: 12px;
}

body[data-screen="sale"] .stats,
body[data-screen="issue"] .stats,
body[data-screen="return"] .stats,
body[data-screen="inventory"] .stats,
body[data-screen="warehouse"] .stats,
body[data-screen="settings"] .stats {
  display: none;
}

body[data-screen="inventory"] .app > .profile,
body[data-screen="history"] .app > .profile,
body[data-screen="inventory"] .app > .stats,
body[data-screen="history"] .app > .stats {
  display: none;
}

body[data-screen="finance"] .stats {
  margin-bottom: var(--space-2);
}

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

  .issue-cart-panel {
    position: static;
  }

  .finance-row {
    grid-template-columns: minmax(0, 1fr) minmax(108px, auto);
  }

  .finance-row > button,
  .finance-row > .money-due {
    grid-column: 1 / -1;
  }
}

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

  .more-list button {
    min-height: 72px;
    padding: var(--space-3);
    border-radius: 22px;
  }

  .tile-icon,
  .more-icon {
    width: 40px;
    height: 40px;
    border-radius: 15px;
  }

  .issue-catalog,
  .issue-cart-panel,
  .form,
  .finance-group,
  .finance-section,
  .product-group,
  .settings-section,
  .control-section {
    padding: var(--space-4);
  }

  .toolbar,
  .pos-scan-row,
  .warehouse-controls,
  .user-controls {
    flex-direction: column;
    align-items: stretch;
  }

  .issue-product,
  .sale-cart-row,
  .warehouse-row,
  .inventory-row {
    grid-template-columns: 1fr;
  }

  .issue-inline-stepper,
  .cart-stepper {
    justify-self: stretch;
    width: 100%;
    justify-content: space-between;
  }

  .sale-cart-row .input {
    width: 100%;
  }

  .compact-metrics,
  .finance-grid,
  .metric-row {
    grid-template-columns: 1fr;
  }

  .card-title,
  .group-title,
  .finance-group-title,
  .holder-head {
    display: grid;
  }

  .stock-detail-list > div {
    grid-template-columns: 1fr;
  }

  .transfer-actions,
  .user-actions,
  .settings-actions {
    display: grid;
    grid-template-columns: 1fr;
  }
}

/* Art director polish: premium depth, focus, motion */
:root {
  --ring: 0 0 0 4px rgba(124, 92, 255, 0.18);
  --ring-strong: 0 0 0 4px rgba(56, 189, 248, 0.20), 0 0 34px rgba(124, 92, 255, 0.22);
  --shadow-premium: 0 22px 72px rgba(0, 0, 0, 0.48), inset 0 1px 0 rgba(255, 255, 255, 0.055);
  --shadow-hover: 0 28px 90px rgba(0, 0, 0, 0.58), 0 0 42px rgba(124, 92, 255, 0.10);
  --glass-surface: rgba(21, 23, 26, 0.72);
}

html {
  scroll-behavior: smooth;
}

body {
  overflow-x: hidden;
}

body::before,
body::after {
  content: "";
  position: fixed;
  pointer-events: none;
  z-index: -1;
}

body::before {
  inset: 0;
  background:
    linear-gradient(rgba(255, 255, 255, 0.018) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.014) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.36), transparent 74%);
}

body::after {
  width: 380px;
  height: 380px;
  right: -180px;
  top: 8%;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.16), transparent 68%);
  filter: blur(10px);
}

::selection {
  background: rgba(124, 92, 255, 0.45);
  color: #fff;
}

.app {
  isolation: isolate;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  overflow: hidden;
  background:
    linear-gradient(180deg, rgba(9, 9, 11, 0.92), rgba(9, 9, 11, 0.70)),
    rgba(9, 9, 11, 0.78);
}

.topbar::after {
  content: "";
  position: absolute;
  left: var(--space-5);
  right: var(--space-5);
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(56, 189, 248, 0.42), rgba(168, 85, 247, 0.38), transparent);
  opacity: 0.64;
}

.profile {
  position: relative;
  overflow: hidden;
}

.profile::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 0% 0%, rgba(56, 189, 248, 0.11), transparent 34%);
  pointer-events: none;
}

.profile > *,
.topbar > * {
  position: relative;
  z-index: 1;
}

button,
summary,
.stock-disclosure summary,
.category-tabs button,
.period-switch button {
  user-select: none;
}

button,
.primary,
.secondary,
.danger,
.icon-btn,
.compact-action,
.text-action,
.action-tile,
.more-list button {
  position: relative;
  overflow: hidden;
}

.primary::before,
.action-tile.primary-tile::before,
.tabs button.active::before {
  content: "";
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  background: linear-gradient(115deg, transparent 0%, rgba(255, 255, 255, 0.18) 42%, transparent 70%);
  opacity: 0;
  transform: translateX(-58%);
  transition: opacity 220ms ease, transform 520ms ease;
  pointer-events: none;
}

.primary:hover::before,
.action-tile.primary-tile:hover::before,
.tabs button.active:hover::before {
  opacity: 1;
  transform: translateX(58%);
}

button:focus-visible,
summary:focus-visible,
.input:focus-visible,
.select:focus-visible,
.stock-disclosure summary:focus-visible {
  outline: none;
  border-color: rgba(56, 189, 248, 0.62);
  box-shadow: var(--ring-strong);
}

button:disabled,
.primary:disabled,
.secondary:disabled,
.danger:disabled {
  cursor: not-allowed;
  opacity: 0.48;
  transform: none !important;
  box-shadow: none !important;
}

.input,
.select,
.file-input {
  transition: border-color 180ms ease, box-shadow 180ms ease, background 180ms ease, transform 180ms ease;
}

.input:hover,
.select:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.058);
}

.input:focus,
.select:focus {
  transform: translateY(-1px);
}

.card,
.stat,
.action-tile,
.finance-section,
.finance-group,
.warehouse-row,
.inventory-row,
.issue-product,
.sale-cart-row,
.settings-section,
.control-section,
.product-group,
.event,
.more-list button,
.transfer-review,
.invite-row,
.rule-row,
.holder-card,
.alert-card {
  box-shadow: var(--shadow-premium);
}

@media (hover: hover) {
  .card:hover,
  .stat:hover,
  .action-tile:hover,
  .finance-section:hover,
  .finance-group:hover,
  .warehouse-row:hover,
  .inventory-row:hover,
  .issue-product:hover,
  .sale-cart-row:hover,
  .settings-section:hover,
  .control-section:hover,
  .product-group:hover,
  .event:hover,
  .more-list button:hover,
  .transfer-review:hover,
  .invite-row:hover,
  .rule-row:hover,
  .holder-card:hover,
  .alert-card:hover {
    box-shadow: var(--shadow-hover);
  }
}

.stat,
.card,
.action-tile,
.finance-section,
.product-group,
.settings-section,
.control-section,
.event {
  position: relative;
  overflow: hidden;
}

.stat::after,
.card::after,
.finance-section::after,
.product-group::after,
.settings-section::after,
.control-section::after,
.event::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.08), transparent 24%, transparent 78%, rgba(124, 92, 255, 0.08));
  opacity: 0.48;
  pointer-events: none;
}

.stat > *,
.card > *,
.action-tile > *,
.finance-section > *,
.product-group > *,
.settings-section > *,
.control-section > *,
.event > * {
  position: relative;
  z-index: 1;
}

.tabs {
  overflow: hidden;
}

.tabs::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background:
    radial-gradient(circle at 18% 0%, rgba(56, 189, 248, 0.12), transparent 34%),
    radial-gradient(circle at 82% 0%, rgba(168, 85, 247, 0.14), transparent 34%);
  pointer-events: none;
}

.tabs button {
  z-index: 1;
}

.tabs .nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  margin-bottom: 2px;
  transition: transform 180ms ease, opacity 180ms ease;
}

.tabs button.active .nav-icon {
  transform: translateY(-1px) scale(1.04);
}

.pill,
.status {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.pill.blue,
.status {
  text-shadow: 0 0 18px rgba(124, 92, 255, 0.28);
}

.empty {
  position: relative;
  overflow: hidden;
  border-style: dashed;
  background:
    radial-gradient(circle at 50% 0%, rgba(56, 189, 248, 0.11), transparent 38%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.046), rgba(255, 255, 255, 0.018)),
    var(--panel);
}

.empty::before {
  width: 56px;
  height: 56px;
  border-radius: 20px;
  box-shadow: 0 18px 48px rgba(124, 92, 255, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.10);
}

.empty::after {
  content: "";
  position: absolute;
  width: 140px;
  height: 140px;
  border-radius: 999px;
  background: radial-gradient(circle, rgba(124, 92, 255, 0.10), transparent 70%);
  filter: blur(6px);
  pointer-events: none;
}

.empty b,
.empty span {
  position: relative;
  z-index: 1;
}

.skeleton-hero,
.skeleton-card {
  box-shadow: var(--shadow-premium);
}

.toast {
  animation: toast-rise 220ms ease both;
}

@keyframes toast-rise {
  from {
    opacity: 0;
    transform: translate(-50%, 10px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0) scale(1);
  }
}

.panel > * {
  animation-duration: 280ms;
}

.panel > *:nth-child(2) {
  animation-delay: 40ms;
}

.panel > *:nth-child(3) {
  animation-delay: 70ms;
}

.panel > *:nth-child(4) {
  animation-delay: 95ms;
}

.issue-cart-panel,
.pos-cart-panel {
  position: sticky;
  top: calc(92px + env(safe-area-inset-top));
}

.stock-disclosure[open] {
  border-color: rgba(124, 92, 255, 0.20);
  box-shadow: 0 14px 44px rgba(0, 0, 0, 0.26);
}

.stock-disclosure summary span {
  color: var(--muted-2);
}

.stock-disclosure[open] summary span {
  color: var(--blue-dark);
}

.money-due,
.compact-metrics .debt,
.alert-card.warning {
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.045);
}

.control-search,
.toolbar,
.pos-scan-row {
  position: relative;
}

@media (max-width: 980px) {
  .issue-cart-panel,
  .pos-cart-panel {
    position: static;
  }
}

@media (max-width: 640px) {
  body::before {
    background-size: 48px 48px;
  }

  .topbar {
    padding-bottom: var(--space-3);
  }

  .profile {
    margin-top: var(--space-3);
  }

  .stat,
  .card,
  .action-tile,
  .finance-section,
  .finance-group,
  .warehouse-row,
  .inventory-row,
  .issue-product,
  .sale-cart-row,
  .settings-section,
  .control-section,
  .product-group,
  .event,
  .more-list button {
    box-shadow: 0 16px 46px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.045);
  }

  .tabs {
    border-radius: 30px;
  }

  .tabs button {
    min-height: 52px;
    border-radius: 22px;
  }

  .empty {
    min-height: 142px;
  }
}

/* Mobile-first Telegram polish */
@media (max-width: 680px) {
  :root {
    --radius-card: 20px;
    --radius-sheet: 28px;
    --radius-button: 16px;
    --radius-input: 16px;
    --shadow-premium: 0 12px 34px rgba(0, 0, 0, 0.34), inset 0 1px 0 rgba(255, 255, 255, 0.045);
    --shadow-hover: 0 14px 40px rgba(0, 0, 0, 0.38), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  }

  html,
  body {
    width: 100%;
    max-width: 100%;
    overscroll-behavior-y: none;
  }

  body {
    background:
      radial-gradient(circle at 20% -10%, rgba(124, 92, 255, 0.18), transparent 23rem),
      linear-gradient(180deg, #09090b 0%, #0b0c10 54%, #09090b 100%);
  }

  body::after {
    width: 260px;
    height: 260px;
    right: -150px;
    top: 18%;
    opacity: 0.72;
  }

  .app {
    width: 100%;
    max-width: none;
    padding: 12px;
    padding-bottom: calc(96px + env(safe-area-inset-bottom));
  }

  .topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin: -12px -12px 0;
    padding: calc(12px + env(safe-area-inset-top)) 12px 10px;
    border-radius: 0 0 22px 22px;
  }

  .eyebrow {
    font-size: 10px;
    line-height: 1.15;
  }

  h1 {
    margin-top: 2px;
    font-size: 26px;
    line-height: 1.08;
  }

  .icon-btn,
  .refresh-btn {
    width: 44px;
    height: 44px;
    min-width: 44px;
    border-radius: 16px;
  }

  .profile {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    margin-top: 12px;
    padding: 12px;
    border-radius: 20px;
  }

  .profile strong {
    overflow: hidden;
    font-size: 15px;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

  .profile span {
    font-size: 12px;
  }

  .status {
    align-self: center;
    max-width: 96px;
    overflow: hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
  }

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

  .stat {
    min-height: 86px;
    padding: 14px;
    border-radius: 18px;
  }

  .stat span {
    font-size: 11px;
  }

  .stat strong {
    margin-top: 8px;
    font-size: 18px;
    line-height: 1.12;
    word-break: break-word;
  }

  .panel {
    display: grid;
    gap: 12px;
  }

  .welcome,
  .control-hero {
    min-height: 128px;
    padding: 18px;
    border-radius: 24px;
  }

  .welcome h2,
  .control-hero h2 {
    max-width: 100%;
    font-size: 25px;
    line-height: 1.08;
  }

  .welcome span {
    font-size: 12px;
  }

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

  .action-tile {
    min-height: 126px;
    padding: 14px;
    border-radius: 20px;
  }

  .action-tile span {
    font-size: 17px;
    line-height: 1.14;
  }

  .action-tile small {
    margin-top: 6px;
    font-size: 12px;
    line-height: 1.28;
  }

  .tile-top {
    margin-bottom: 16px;
  }

  .tile-icon,
  .more-icon {
    width: 38px;
    height: 38px;
    border-radius: 14px;
  }

  .tile-icon svg,
  .more-icon svg {
    width: 17px;
    height: 17px;
  }

  .more-list {
    gap: 10px;
  }

  .more-list button {
    min-height: 68px;
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 12px;
    padding: 12px;
    border-radius: 20px;
  }

  .more-row-content b {
    font-size: 15px;
  }

  .more-row-content span {
    font-size: 12px;
  }

  .section-head,
  .form-title,
  .group-title,
  .finance-group-title,
  .holder-head {
    display: grid;
    gap: 4px;
    align-items: start;
  }

  .section-head b,
  .form-title b,
  .group-title b,
  .finance-group-title b {
    font-size: 17px;
    line-height: 1.2;
  }

  .section-head span,
  .form-title span,
  .group-title span,
  .finance-group-title span {
    font-size: 12px;
  }

  .toolbar,
  .pos-scan-row,
  .warehouse-controls,
  .import-actions,
  .settings-actions,
  .user-controls,
  .transfer-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .input,
  .select,
  .primary,
  .secondary,
  .danger,
  .compact-action {
    min-height: 48px;
    width: 100%;
    font-size: 15px;
  }

  .text-action {
    min-height: 42px;
  }

  .issue-workspace {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .issue-catalog,
  .issue-cart-panel,
  .form,
  .finance-group,
  .finance-section,
  .product-group,
  .settings-section,
  .control-section,
  .import-panel,
  .warehouse-summary {
    padding: 14px;
    border-radius: 22px;
  }

  .issue-product,
  .sale-cart-row,
  .warehouse-row,
  .inventory-row,
  .finance-row,
  .rule-row,
  .invite-row,
  .holder-card,
  .alert-card,
  .transfer-review {
    grid-template-columns: 1fr;
    gap: 10px;
    padding: 12px;
    border-radius: 18px;
  }

  .issue-product b,
  .sale-cart-row b,
  .warehouse-product b,
  .finance-row b {
    font-size: 14px;
    line-height: 1.22;
  }

  .issue-product span,
  .sale-cart-row span,
  .warehouse-product span,
  .finance-row span {
    font-size: 12px;
    line-height: 1.32;
  }

  .issue-inline-stepper,
  .cart-stepper {
    width: 100%;
    min-height: 46px;
    justify-content: space-between;
  }

  .issue-inline-stepper button,
  .cart-stepper button {
    width: 40px;
    height: 38px;
  }

  .sale-cart-row .input {
    width: 100%;
    text-align: left;
  }

  .compact-metrics,
  .finance-grid,
  .control-summary,
  .warehouse-summary,
  .metric-row {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .compact-metrics > div,
  .warehouse-summary > div,
  .metric-row > div {
    padding: 12px;
    border-radius: 16px;
  }

  .product-card {
    padding: 14px;
    border-radius: 20px;
  }

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

  .pill {
    justify-self: start;
    max-width: 100%;
  }

  .category-tabs,
  .period-switch {
    margin: 0 -12px;
    padding: 0 12px 4px;
    scroll-padding-left: 12px;
  }

  .category-tabs button,
  .period-switch button {
    min-height: 40px;
    padding: 0 14px;
    font-size: 12px;
  }

  .timeline {
    gap: 10px;
  }

  .event {
    padding: 12px;
    border-radius: 20px;
  }

  .stock-detail-list > div {
    grid-template-columns: 1fr;
  }

  .empty {
    min-height: 132px;
    padding: 18px;
    border-radius: 22px;
  }

  .empty::before {
    width: 48px;
    height: 48px;
    border-radius: 18px;
  }

  .skeleton-hero {
    min-height: 132px;
    padding: 16px;
    border-radius: 22px;
  }

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

  .skeleton-card {
    min-height: 92px;
    border-radius: 20px;
  }

  .tabs {
    left: 10px;
    right: 10px;
    bottom: max(10px, env(safe-area-inset-bottom));
    width: auto;
    max-width: none;
    transform: none;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 4px;
    padding: 6px;
    border-radius: 26px;
    background: rgba(21, 23, 26, 0.90);
  }

  .tabs button {
    min-width: 0;
    min-height: 54px;
    padding: 7px 4px;
    border-radius: 20px;
    font-size: 10px;
    line-height: 1.1;
  }

  .tabs .nav-icon {
    width: 20px;
    height: 20px;
    margin-bottom: 1px;
  }

  .tabs svg {
    width: 18px;
    height: 18px;
  }

  .tabs .access-role:not(.hidden) {
    grid-column: 1 / -1;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: calc(86px + env(safe-area-inset-bottom));
    width: auto;
    transform: none;
    border-radius: 20px;
    text-align: center;
  }

  @keyframes toast-rise {
    from {
      opacity: 0;
      transform: translateY(10px) scale(0.98);
    }
    to {
      opacity: 1;
      transform: translateY(0) scale(1);
    }
  }
}

@media (max-width: 390px) {
  .app {
    padding-left: 10px;
    padding-right: 10px;
  }

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

  .action-tile {
    min-height: 104px;
  }

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

  .tabs button {
    font-size: 9.5px;
  }
}

/* Telegram Mini App shell mode */
@supports (height: 100dvh) {
  html,
  body {
    min-height: 100dvh;
  }
}

@media (max-width: 680px) {
  html {
    min-height: var(--tg-stable-viewport-height, 100dvh);
    background: #09090b;
  }

  body {
    min-height: var(--tg-viewport-height, 100dvh);
    margin: 0;
    background-color: #09090b;
    touch-action: manipulation;
  }

  .app {
    min-height: var(--tg-viewport-height, 100dvh);
    margin: 0;
    border-radius: 0;
    animation: none !important;
    transform: none !important;
    will-change: auto !important;
  }

  .topbar {
    min-height: 68px;
    box-shadow: 0 12px 38px rgba(0, 0, 0, 0.28);
  }

  .panel {
    padding-bottom: 4px;
  }

  .tabs {
    box-shadow:
      0 18px 52px rgba(0, 0, 0, 0.58),
      0 0 0 1px rgba(255, 255, 255, 0.045),
      inset 0 1px 0 rgba(255, 255, 255, 0.08);
  }

  .tabs button {
    -webkit-touch-callout: none;
  }

  input,
  select,
  textarea {
    font-size: 16px;
  }

  .input,
  .select {
    transform: translateZ(0);
  }

  .primary,
  .secondary,
  .danger,
  .compact-action,
  .icon-btn,
  .tabs button,
  .issue-inline-stepper button,
  .cart-stepper button {
    cursor: default;
  }

  @media (hover: hover) {
    button:hover,
    .action-tile:hover,
    .more-list button:hover,
    .card:hover,
    .issue-product:hover,
    .finance-row:hover,
    .warehouse-row:hover {
      transform: none;
    }
  }
}

/* Telegram iOS hotfix: stable icons and pinned bottom nav */
.tile-icon,
.more-icon,
.nav-icon,
.icon-btn,
.ui-icon {
  overflow: hidden;
  line-height: 0;
}

.tile-icon svg,
.more-icon svg,
.nav-icon svg,
.icon-btn svg,
.ui-icon svg,
[data-lucide] {
  display: block !important;
  width: 18px !important;
  height: 18px !important;
  min-width: 18px !important;
  min-height: 18px !important;
  max-width: 18px !important;
  max-height: 18px !important;
  flex: 0 0 18px !important;
  stroke: currentColor;
  stroke-width: 2;
  transform: none !important;
}

.tile-icon svg,
.more-icon svg {
  width: 19px !important;
  height: 19px !important;
  min-width: 19px !important;
  min-height: 19px !important;
  max-width: 19px !important;
  max-height: 19px !important;
  flex-basis: 19px !important;
}

@media (max-width: 680px) {
  .app {
    padding-bottom: calc(118px + env(safe-area-inset-bottom, 0px)) !important;
  }

  .tabs {
    position: fixed !important;
    z-index: 9999 !important;
    left: 10px !important;
    right: 10px !important;
    bottom: calc(18px + env(safe-area-inset-bottom, 0px)) !important;
    width: auto !important;
    max-width: none !important;
    transform: translate3d(0, 0, 0) !important;
    will-change: transform;
  }

  .tabs .nav-icon svg,
  .tabs [data-lucide] {
    width: 17px !important;
    height: 17px !important;
    min-width: 17px !important;
    min-height: 17px !important;
    max-width: 17px !important;
    max-height: 17px !important;
    flex-basis: 17px !important;
  }

  .icon-btn svg {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    max-width: 22px !important;
    max-height: 22px !important;
    flex-basis: 22px !important;
  }

  .inline-price-form.stock-price-form {
    margin-top: 0;
    padding: 10px;
    border-radius: 16px;
  }
}

/* Final mobile nav compactness */
.hidden,
.tabs button.hidden,
.access-role.hidden {
  display: none !important;
}

@media (max-width: 680px) {
  .tabs {
    max-height: 74px !important;
    overflow: hidden !important;
  }

  .tabs .access-role:not(.hidden) {
    grid-column: 1 / -1;
    max-height: 54px !important;
  }
}

/* Final iOS icon centering and non-overlapping header */
@media (max-width: 680px) {
  .topbar {
    position: relative !important;
    top: auto !important;
    z-index: 2 !important;
  }

  .tile-icon,
  .more-icon,
  .nav-icon,
  .icon-btn,
  .ui-icon {
    position: relative !important;
    display: grid !important;
    place-items: center !important;
    align-items: center !important;
    justify-items: center !important;
    overflow: hidden !important;
  }

  .tile-icon svg,
  .more-icon svg,
  .nav-icon svg,
  .icon-btn svg,
  .ui-icon svg {
    position: absolute !important;
    left: 50% !important;
    top: 50% !important;
    right: auto !important;
    bottom: auto !important;
    margin: 0 !important;
    transform: translate(-50%, -50%) !important;
    transform-origin: center center !important;
  }

  .more-list {
    padding-top: 2px;
  }
}

/* Profile tab + stable Lucide rendering */
.tabs {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.tabs button {
  min-width: 0;
}

.tabs .access-role:not(.hidden) {
  grid-column: 1 / -1;
}

.nav-icon,
.tile-icon,
.more-icon,
.quick-action-icon,
.dashboard-kpi-icon,
.action-item-icon,
.ui-icon {
  flex: 0 0 auto;
  display: grid !important;
  place-items: center !important;
}

.nav-icon svg,
.tile-icon svg,
.more-icon svg,
.quick-action-icon svg,
.dashboard-kpi-icon svg,
.action-item-icon svg,
.ui-icon svg {
  display: block !important;
  position: static !important;
  inset: auto !important;
  margin: 0 !important;
  transform: none !important;
}

@media (max-width: 680px) {
  .tabs {
    grid-template-columns: repeat(5, minmax(0, 1fr)) !important;
    min-height: 74px;
    max-height: 82px !important;
    gap: 4px !important;
    padding: 8px !important;
  }

  .tabs button {
    gap: 4px !important;
    min-height: 58px !important;
    padding: 7px 3px !important;
    font-size: 10px !important;
    line-height: 1.05 !important;
  }

  .tabs button.active {
    border-radius: 22px !important;
  }

  .tabs .nav-icon {
    width: 22px !important;
    height: 22px !important;
    min-width: 22px !important;
    min-height: 22px !important;
    margin: 0 auto 1px !important;
  }

  .tabs .nav-icon svg {
    width: 18px !important;
    height: 18px !important;
    min-width: 18px !important;
    min-height: 18px !important;
    max-width: 18px !important;
    max-height: 18px !important;
  }
}

/* Manual inventory counter */
.inventory-product small {
  display: inline-flex;
  width: fit-content;
  margin-top: 8px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted-2);
  background: rgba(255, 255, 255, 0.035);
  font-size: 12px;
}

.inventory-row.changed .inventory-product small {
  border-color: rgba(56, 189, 248, 0.30);
  color: var(--blue-dark);
  background: rgba(56, 189, 248, 0.10);
}

.manual-inventory-control {
  display: grid;
  grid-template-columns: 48px minmax(96px, 1fr) 48px;
  gap: 8px;
  align-items: stretch;
}

.manual-inventory-control button {
  min-height: 52px;
  border-radius: 16px;
  font-size: 24px;
  font-weight: 600;
}

.manual-inventory-control label {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 52px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.045);
  overflow: hidden;
}

.manual-inventory-control label > span {
  position: absolute;
  top: 5px;
  color: var(--muted-2);
  font-size: 10px;
  line-height: 1;
}

.manual-inventory-control .input {
  position: absolute;
  inset: 0;
  min-height: 0;
  width: 100%;
  height: 100%;
  border: 0;
  background: transparent;
  color: transparent;
  caret-color: var(--text);
  text-align: center;
  font-size: 20px;
  font-weight: 600;
  box-shadow: none;
}

.manual-inventory-control .input:focus {
  color: var(--text);
  background: rgba(9, 9, 11, 0.92);
  transform: none;
}

.manual-inventory-control .input:focus + strong {
  opacity: 0;
}

.manual-inventory-control strong {
  padding-top: 12px;
  color: var(--text);
  font-size: 20px;
  font-weight: 600;
  pointer-events: none;
}

/* Employee Center */
.employee-hero {
  display: grid;
  grid-template-columns: 76px 1fr;
  gap: 16px;
  align-items: center;
  padding: 18px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 26px;
  background:
    radial-gradient(circle at 18% 0%, rgba(99, 102, 241, 0.24), transparent 42%),
    rgba(255, 255, 255, 0.045);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.employee-avatar {
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 24px;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.96), rgba(139, 92, 246, 0.92));
  color: #fff;
  font-size: 32px;
  font-weight: 600;
  box-shadow: 0 18px 42px rgba(79, 70, 229, 0.28);
}

.employee-hero span,
.employee-hero p,
.employee-money-card span,
.employee-money-card small {
  color: var(--muted-2, var(--muted));
}

.employee-hero h2 {
  margin: 4px 0;
  font-size: 26px;
  line-height: 1.05;
  letter-spacing: 0;
}

.employee-hero p {
  margin: 0;
  font-size: 13px;
}

.profile-periods {
  margin-top: 12px;
}

.profile-kpis {
  margin-top: 12px;
}

.profile-metric-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.profile-metric {
  display: grid;
  align-content: center;
  gap: 6px;
  min-width: 0;
  min-height: 82px;
  padding: 12px 8px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text, var(--ink));
  text-align: left;
  box-shadow: var(--shadow);
}

.profile-metric.accent {
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.22), rgba(139, 92, 246, 0.18));
}

.profile-metric span {
  overflow: hidden;
  color: var(--muted-2, var(--muted));
  font-size: 11px;
  line-height: 1.1;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-metric b {
  overflow-wrap: anywhere;
  color: var(--text, var(--ink));
  font-size: 17px;
  line-height: 1.05;
  letter-spacing: 0;
}

.profile-focus-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.profile-section {
  margin-top: 12px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: var(--shadow);
}

.employee-money-card {
  display: grid;
  align-content: start;
  gap: 7px;
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 24px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text, var(--ink));
  text-align: left;
  box-shadow: var(--shadow);
}

.employee-money-card.stock-focus {
  background:
    radial-gradient(circle at 10% 0%, rgba(59, 130, 246, 0.14), transparent 48%),
    rgba(255, 255, 255, 0.045);
}

.employee-money-card b {
  display: block;
  color: var(--text, var(--ink));
  font-size: 23px;
  line-height: 1.05;
}

.employee-money-card small {
  display: block;
  font-size: 13px;
}

.profile-section {
  padding: 16px;
}

.compact-profile-section {
  padding: 14px;
}

.profile-section .stock-disclosure {
  margin-top: 0;
}

.profile-section .timeline {
  margin-top: 8px;
}

/* V2.2 Personal Dashboard */
body.home-screen .app > .profile,
body.home-screen .app > .stats,
body.profile-screen .app > .profile,
body.profile-screen .app > .stats {
  display: none;
}

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

.dashboard-user {
  display: grid;
  grid-template-columns: 58px 1fr;
  gap: 12px;
  align-items: center;
  min-width: 0;
  flex: 1;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.dashboard-avatar {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 20px;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.92), rgba(139, 92, 246, 0.88));
  color: #fff;
  font-size: 24px;
  font-weight: 600;
  box-shadow: 0 18px 42px rgba(79, 70, 229, 0.22);
}

.dashboard-user small,
.dashboard-user em {
  display: block;
  color: var(--muted-2, var(--muted));
  font-style: normal;
  font-size: 12px;
}

.dashboard-user b {
  display: block;
  margin: 2px 0;
  overflow: hidden;
  color: var(--text, var(--ink));
  font-size: 22px;
  line-height: 1.05;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.notification-button {
  position: relative;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text, var(--ink));
  box-shadow: var(--shadow);
}

.notification-button svg {
  width: 22px;
  height: 22px;
}

.notification-button strong {
  position: absolute;
  top: -4px;
  right: -4px;
  min-width: 21px;
  height: 21px;
  padding: 0 6px;
  border: 2px solid var(--bg);
  border-radius: 999px;
  background: #ff6b35;
  color: #fff;
  font-size: 11px;
  line-height: 17px;
  text-align: center;
}

.primary-action {
  display: grid;
  gap: 10px;
  margin-bottom: 12px;
  padding: 18px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 28px;
  background:
    radial-gradient(circle at 0% 0%, rgba(99, 102, 241, 0.28), transparent 38%),
    rgba(255, 255, 255, 0.055);
  box-shadow: var(--shadow);
}

.primary-action.critical {
  background:
    radial-gradient(circle at 0% 0%, rgba(255, 107, 53, 0.26), transparent 42%),
    rgba(255, 255, 255, 0.055);
}

.primary-action.high {
  background:
    radial-gradient(circle at 0% 0%, rgba(245, 158, 11, 0.24), transparent 42%),
    rgba(255, 255, 255, 0.055);
}

.primary-action > span {
  width: fit-content;
  padding: 5px 9px;
  border: 1px solid rgba(255, 255, 255, 0.10);
  border-radius: 999px;
  color: var(--muted-2, var(--muted));
  font-size: 12px;
}

.primary-action h2 {
  margin: 0;
  color: var(--text, var(--ink));
  font-size: 28px;
  line-height: 1.05;
  letter-spacing: 0;
}

.primary-action p {
  margin: 0;
  color: var(--muted-2, var(--muted));
}

.primary-action strong {
  color: var(--text, var(--ink));
  font-size: 26px;
  line-height: 1;
}

.dashboard-kpis,
.quick-action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 12px;
}

.dashboard-kpi {
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: var(--shadow);
}

.dashboard-kpi.accent {
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.20), rgba(139, 92, 246, 0.18));
}

.dashboard-kpi-icon,
.quick-action-icon,
.action-item-icon,
.notification-icon {
  display: grid;
  place-items: center;
  color: var(--text, var(--ink));
}

.dashboard-kpi-icon {
  width: 32px;
  height: 32px;
  margin-bottom: 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
}

.dashboard-kpi span,
.action-item small,
.action-item em,
.notification-row small {
  display: block;
  color: var(--muted-2, var(--muted));
  font-size: 12px;
}

.dashboard-kpi b {
  display: block;
  margin-top: 5px;
  overflow-wrap: anywhere;
  color: var(--text, var(--ink));
  font-size: 18px;
  line-height: 1.1;
}

.quick-actions,
.action-center,
.recent-home {
  margin-top: 12px;
}

.quick-action-grid button {
  display: grid;
  gap: 10px;
  justify-items: start;
  min-height: 86px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 22px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text, var(--ink));
  text-align: left;
  box-shadow: var(--shadow);
}

.quick-action-icon {
  width: 34px;
  height: 34px;
  border-radius: 13px;
  background: rgba(255, 255, 255, 0.07);
}

.quick-action-grid button span {
  font-weight: 600;
}

.action-item-list,
.notification-list {
  display: grid;
  gap: 10px;
}

.action-item,
.notification-row {
  display: grid;
  grid-template-columns: 42px 1fr auto;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-width: 0;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 22px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--text, var(--ink));
  text-align: left;
  box-shadow: var(--shadow);
}

.action-item.critical,
.notification-row.critical {
  border-color: rgba(255, 107, 53, 0.28);
}

.action-item.high,
.notification-row.high {
  border-color: rgba(245, 158, 11, 0.26);
}

.action-item-icon,
.notification-icon {
  width: 42px;
  height: 42px;
  border-radius: 15px;
  background: rgba(255, 255, 255, 0.07);
}

.action-item b,
.notification-row b {
  display: block;
  color: var(--text, var(--ink));
  font-size: 15px;
  line-height: 1.2;
}

.action-item strong,
.notification-row strong {
  color: var(--text, var(--ink));
  font-size: 14px;
  white-space: nowrap;
}

.notification-row.read {
  opacity: 0.58;
}

.notification-actions {
  margin: 10px 0 12px;
}

/* V2.3 Team Profiles */
.team-toolbar {
  display: grid;
  grid-template-columns: 1.35fr 1fr 1fr 1fr;
  gap: 10px;
  margin-bottom: 10px;
}

.team-filter-row {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow-x: auto;
}

.team-filter-row label {
  display: inline-flex;
  grid-auto-flow: column;
  align-items: center;
  gap: 7px;
  min-width: fit-content;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted-2, var(--muted));
  font-size: 12px;
}

.team-list {
  display: grid;
  gap: 12px;
}

.team-card {
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 24px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.045);
  box-shadow: var(--shadow);
}

.team-card-main {
  display: grid;
  grid-template-columns: 52px 1fr;
  gap: 12px;
  align-items: center;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.team-avatar {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border-radius: 18px;
  background: linear-gradient(145deg, rgba(59, 130, 246, 0.92), rgba(139, 92, 246, 0.88));
  color: #fff;
  font-size: 22px;
  font-weight: 600;
}

.team-card-main b {
  display: block;
  color: var(--text, var(--ink));
  font-size: 17px;
}

.team-card-main small,
.team-card-metrics span {
  display: block;
  color: var(--muted-2, var(--muted));
  font-size: 12px;
}

.team-card-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.team-card-metrics > div {
  min-width: 0;
  padding: 10px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.04);
}

.team-card-metrics b {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: var(--text, var(--ink));
  font-size: 14px;
}

.team-flags,
.team-warning-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.team-flags span,
.team-warning-list span {
  padding: 5px 8px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  color: var(--muted-2, var(--muted));
  background: rgba(255, 255, 255, 0.035);
  font-size: 11px;
}

.team-profile-hero {
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 12px;
  min-height: 92px;
  margin-bottom: 10px;
  padding: 14px;
  border-radius: 24px;
}

.team-profile-hero .employee-avatar {
  width: 58px;
  height: 58px;
  border-radius: 19px;
  font-size: 24px;
}

.team-profile-hero h2 {
  max-width: 100%;
  overflow: hidden;
  font-size: 23px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-profile-hero p,
.team-profile-hero span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.team-profile-actions.top-actions {
  margin-top: 0;
  padding: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

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

.team-action-buttons .compact-action,
.team-action-buttons .team-telegram-link {
  min-height: 42px;
  border-radius: 16px;
  padding: 10px 12px;
  font-size: 13px;
  white-space: nowrap;
}

.compact-periods {
  margin: 10px 0;
  padding: 6px;
  border-radius: 20px;
}

.compact-periods button {
  min-height: 38px;
  padding: 8px 9px;
  font-size: 13px;
}

.team-profile-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.team-profile-kpis .stat {
  min-width: 0;
  min-height: 82px;
  padding: 10px;
  border-radius: 18px;
}

.team-profile-kpis .stat span {
  font-size: 11px;
  line-height: 1.08;
}

.team-profile-kpis .stat b {
  margin-top: 5px;
  overflow-wrap: anywhere;
  font-size: 15px;
  line-height: 1.06;
}

.team-profile-tabs {
  display: flex;
  gap: 8px;
  margin: 10px 0;
  overflow-x: auto;
}

.team-profile-tabs button {
  min-width: fit-content;
  border: 1px solid var(--glass-border, var(--line));
  border-radius: 999px;
  padding: 8px 11px;
  background: rgba(255, 255, 255, 0.045);
  color: var(--muted-2, var(--muted));
  font-size: 12px;
  font-weight: 600;
}

.team-profile-tabs button.active {
  color: #fff;
  background: linear-gradient(135deg, #5b67f1, #9a5cf5);
}

.team-profile-body,
.team-profile-actions {
  margin-top: 10px;
}

.team-telegram-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  text-decoration: none;
}

@media (max-width: 680px) {
  .team-toolbar {
    grid-template-columns: 1fr;
  }

  .team-card-metrics {
    grid-template-columns: 1fr;
  }

  .team-profile-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .team-profile-kpis .stat {
    min-height: 78px;
    padding: 9px 7px;
  }

  .team-profile-kpis .stat b {
    font-size: 14px;
  }

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

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

  .primary-action h2 {
    font-size: 24px;
  }

  .action-item,
  .notification-row {
    grid-template-columns: 40px 1fr;
  }

  .action-item strong,
  .notification-row strong,
  .action-item > svg {
    grid-column: 2;
    justify-self: start;
  }

  .employee-hero {
    grid-template-columns: 64px 1fr;
    gap: 12px;
    padding: 16px;
    border-radius: 24px;
  }

  .employee-avatar {
    width: 64px;
    height: 64px;
    border-radius: 20px;
    font-size: 28px;
  }

  .employee-hero h2 {
    font-size: 22px;
  }

  .employee-money-card {
    align-items: flex-start;
    flex-direction: column;
  }

  .inventory-list {
    padding-bottom: calc(176px + env(safe-area-inset-bottom, 0px));
  }

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

  .manual-inventory-control {
    grid-template-columns: 54px minmax(0, 1fr) 54px;
  }

  .manual-inventory-control button,
  .manual-inventory-control label {
    min-height: 56px;
  }

  .inventory-submit {
    left: 10px !important;
    right: 10px !important;
    bottom: calc(98px + env(safe-area-inset-bottom, 0px)) !important;
    width: auto !important;
    grid-template-columns: 1fr;
    padding: 10px;
    border: 1px solid var(--glass-border);
    border-radius: 22px;
    background: rgba(21, 23, 26, 0.92);
    box-shadow: 0 18px 52px rgba(0, 0, 0, 0.48);
    backdrop-filter: var(--glass);
    -webkit-backdrop-filter: var(--glass);
  }
}

/* Profile polish: centered KPIs, safe segmented control, install card */
body.profile-screen {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", Inter, "Segoe UI", sans-serif;
}

body.profile-screen .topbar h1 {
  font-weight: 600;
  letter-spacing: 0;
}

body.profile-screen .employee-hero {
  border-radius: 28px;
}

body.profile-screen .employee-hero h2,
body.profile-screen .profile-metric b,
body.profile-screen .employee-money-card b,
body.profile-screen .profile-section b {
  font-weight: 600;
  letter-spacing: 0;
}

body.profile-screen .profile-periods {
  display: grid !important;
  grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
  gap: 8px !important;
  width: 100%;
  margin: 12px 0 0 !important;
  padding: 7px !important;
  overflow: visible !important;
  border: 1px solid rgba(255, 255, 255, 0.075) !important;
  border-radius: 28px !important;
  background: rgba(255, 255, 255, 0.055) !important;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

body.profile-screen .profile-periods button {
  display: grid;
  place-items: center;
  min-width: 0 !important;
  min-height: 44px !important;
  padding: 0 6px !important;
  overflow: hidden;
  border-radius: 21px !important;
  background: rgba(255, 255, 255, 0.055) !important;
  color: rgba(255, 255, 255, 0.66) !important;
  font-size: 13px !important;
  font-weight: 500 !important;
  line-height: 1 !important;
  text-align: center;
  white-space: nowrap;
}

body.profile-screen .profile-periods button.active {
  border: 1px solid rgba(139, 92, 246, 0.42) !important;
  background: rgba(139, 92, 246, 0.20) !important;
  color: #b794ff !important;
  box-shadow: 0 10px 28px rgba(99, 102, 241, 0.16);
}

body.profile-screen .profile-metric-row {
  gap: 8px;
  margin-top: 12px;
}

body.profile-screen .profile-metric {
  justify-items: center;
  align-content: center;
  min-height: 88px;
  padding: 12px 6px;
  border-radius: 22px;
  text-align: center;
}

body.profile-screen .profile-metric span {
  width: 100%;
  color: rgba(255, 255, 255, 0.50);
  font-size: 12px;
  font-weight: 500;
  text-align: center;
}

body.profile-screen .profile-metric b {
  width: 100%;
  color: #fff;
  font-size: clamp(16px, 3.85vw, 18px);
  line-height: 1.05;
  text-align: center;
}

body.profile-screen .profile-metric.accent {
  background:
    radial-gradient(circle at 20% 0%, rgba(59, 130, 246, 0.24), transparent 50%),
    rgba(99, 102, 241, 0.12);
}

body.profile-screen .profile-focus-grid {
  gap: 10px;
}

body.profile-screen .employee-money-card {
  justify-items: start;
  min-height: 128px;
  padding: 18px;
  border-radius: 24px;
}

body.profile-screen .employee-money-card span {
  font-size: 15px;
  font-weight: 500;
}

body.profile-screen .employee-money-card b {
  font-size: clamp(26px, 7.6vw, 32px);
  line-height: 1;
}

body.profile-screen .employee-money-card small {
  color: rgba(255, 255, 255, 0.45);
  font-size: 13px;
  line-height: 1.25;
}

.profile-install-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
  padding: 14px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 24px;
  background:
    radial-gradient(circle at 0% 0%, rgba(59, 130, 246, 0.14), transparent 46%),
    rgba(255, 255, 255, 0.045);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.install-icon,
.install-card-icon {
  display: grid;
  place-items: center;
}

.install-icon {
  width: 46px;
  height: 46px;
  min-width: 46px;
  align-self: center;
  justify-self: center;
}

.install-card-icon {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.06);
  color: #fff;
}

.install-card-icon i,
.install-card-icon svg {
  width: 20px;
  height: 20px;
}

.install-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  min-width: max-content;
}

.profile-install-card b,
.profile-install-card span {
  display: block;
}

.profile-install-card b {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.profile-install-card span {
  margin-top: 3px;
  color: rgba(255, 255, 255, 0.50);
  font-size: 12px;
  line-height: 1.25;
}

/* Home: richer but compact action buttons */
.priority-actions {
  margin-top: 0;
}

.priority-actions .section-head {
  margin-bottom: 10px;
}

.priority-actions .quick-action-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.priority-actions .quick-action-grid button {
  position: relative;
  display: grid;
  grid-template-rows: 42px minmax(0, 1fr);
  justify-items: center;
  align-items: center;
  gap: 10px;
  min-height: 112px;
  overflow: hidden;
  padding: 14px 10px;
  border-color: rgba(168, 85, 247, 0.18);
  border-radius: 26px;
  background:
    radial-gradient(circle at 50% -10%, rgba(168, 85, 247, 0.34), transparent 58%),
    linear-gradient(145deg, rgba(99, 102, 241, 0.13), rgba(147, 51, 234, 0.10)),
    rgba(255, 255, 255, 0.035);
  text-align: center;
  box-shadow:
    0 18px 42px rgba(80, 55, 160, 0.13),
    inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.priority-actions .quick-action-grid button::after {
  content: "";
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 12px;
  height: 2px;
  border-radius: 999px;
  opacity: 0.58;
  background: linear-gradient(90deg, transparent, rgba(196, 181, 253, 0.54), transparent);
}

.priority-actions .quick-action-grid button:nth-child(1) {
  background:
    radial-gradient(circle at 50% -10%, rgba(129, 140, 248, 0.34), transparent 58%),
    linear-gradient(145deg, rgba(79, 70, 229, 0.16), rgba(124, 58, 237, 0.10)),
    rgba(255, 255, 255, 0.035);
}

.priority-actions .quick-action-grid button:nth-child(2) {
  background:
    radial-gradient(circle at 50% -10%, rgba(167, 139, 250, 0.36), transparent 58%),
    linear-gradient(145deg, rgba(124, 58, 237, 0.15), rgba(88, 28, 135, 0.10)),
    rgba(255, 255, 255, 0.035);
}

.priority-actions .quick-action-grid button:nth-child(3) {
  background:
    radial-gradient(circle at 50% -10%, rgba(192, 132, 252, 0.34), transparent 58%),
    linear-gradient(145deg, rgba(147, 51, 234, 0.14), rgba(76, 29, 149, 0.10)),
    rgba(255, 255, 255, 0.035);
}

.priority-actions .quick-action-grid button:nth-child(4) {
  background:
    radial-gradient(circle at 50% -10%, rgba(139, 92, 246, 0.34), transparent 58%),
    linear-gradient(145deg, rgba(109, 40, 217, 0.14), rgba(49, 46, 129, 0.10)),
    rgba(255, 255, 255, 0.035);
}

.priority-actions .quick-action-grid button:nth-child(5) {
  background:
    radial-gradient(circle at 50% -10%, rgba(216, 180, 254, 0.32), transparent 58%),
    linear-gradient(145deg, rgba(126, 34, 206, 0.13), rgba(88, 28, 135, 0.10)),
    rgba(255, 255, 255, 0.035);
}

.priority-actions .quick-action-grid button:nth-child(6) {
  background:
    radial-gradient(circle at 50% -10%, rgba(165, 180, 252, 0.30), transparent 58%),
    linear-gradient(145deg, rgba(67, 56, 202, 0.13), rgba(88, 28, 135, 0.09)),
    rgba(255, 255, 255, 0.035);
}

.priority-actions .quick-action-icon {
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 16px;
  background:
    radial-gradient(circle at 35% 15%, rgba(255, 255, 255, 0.16), transparent 54%),
    rgba(255, 255, 255, 0.075);
  color: #fff;
}

.priority-actions .quick-action-grid button span {
  position: relative;
  z-index: 1;
  display: grid;
  align-items: center;
  width: 100%;
  min-height: 34px;
  color: rgba(255, 255, 255, 0.92);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.12;
  text-align: center;
}

body[data-screen="inventory"] .inventory-note {
  background:
    radial-gradient(circle at 0% 0%, rgba(45, 212, 191, 0.18), transparent 48%),
    rgba(255, 255, 255, 0.045);
}

body[data-screen="inventory"] .inventory-submit {
  grid-template-columns: minmax(0, 1fr) auto;
}

body[data-screen="inventory"] .inventory-comment {
  min-width: 0;
}

@media (max-width: 390px) {
  .priority-actions .quick-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.profile-screen .profile-metric-row {
    gap: 6px;
  }

  body.profile-screen .profile-metric {
    min-height: 82px;
    padding-inline: 4px;
  }

  body.profile-screen .profile-metric b {
    font-size: 15px;
  }

  .profile-install-card {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .profile-install-card .install-actions {
    grid-column: 1 / -1;
    width: 100%;
  }

  .profile-install-card .secondary {
    flex: 1;
  }
}

@media (max-width: 430px) {
  .priority-actions .quick-action-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .priority-actions .quick-action-grid button {
    min-height: 104px;
  }
}

/* Product cards, home priority order and mobile alignment polish */
body.home-screen .panel {
  padding-top: 18px;
}

body.home-screen .dashboard-kpis {
  margin-top: 4px;
  margin-bottom: 14px;
}

body.home-screen .priority-actions {
  margin-top: 4px;
}

body.home-screen .action-center .section-head,
body[data-screen="stock"] .section-head,
.product-detail-section .section-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}

body.home-screen .action-center .section-head > div,
body[data-screen="stock"] .section-head > div,
.product-detail-section .section-head > div {
  min-width: 0;
}

body.home-screen .action-center .section-head b,
body.home-screen .action-center .section-head span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

body.home-screen .action-center .text-action {
  justify-self: end;
  white-space: nowrap;
}

body[data-screen="stock"] .product-group .grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.product-compact-card {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) minmax(72px, auto) 18px;
  gap: 12px;
  align-items: center;
  width: 100%;
  min-height: 74px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 22px;
  background:
    radial-gradient(circle at 0% 0%, rgba(139, 92, 246, 0.13), transparent 42%),
    rgba(255, 255, 255, 0.045);
  color: var(--text);
  text-align: left;
  box-shadow: var(--shadow);
}

.product-compact-card:active {
  transform: scale(0.985);
}

.product-compact-icon {
  display: grid;
  place-items: center;
  width: 46px;
  height: 46px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 17px;
  background:
    radial-gradient(circle at 30% 10%, rgba(255, 255, 255, 0.16), transparent 55%),
    rgba(255, 255, 255, 0.07);
}

.product-compact-svg svg,
.product-compact-card > i {
  width: 20px;
  height: 20px;
}

.product-compact-main,
.product-compact-meta {
  min-width: 0;
}

.product-compact-main b,
.product-compact-main small,
.product-compact-meta b,
.product-compact-meta small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-compact-main b {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.15;
}

.product-compact-main small,
.product-compact-meta small {
  margin-top: 4px;
  color: rgba(255, 255, 255, 0.48);
  font-size: 12px;
  line-height: 1.15;
}

.product-compact-meta {
  text-align: right;
}

.product-compact-meta b {
  color: #fff;
  font-size: 15px;
  font-weight: 600;
}

.product-compact-card > i {
  color: rgba(196, 181, 253, 0.95);
}

.product-detail-hero,
.product-detail-section {
  display: grid;
  gap: 14px;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 28px;
  background:
    radial-gradient(circle at 0% 0%, rgba(124, 92, 255, 0.18), transparent 46%),
    rgba(255, 255, 255, 0.045);
  box-shadow: var(--shadow);
}

.product-detail-hero h2 {
  margin: 4px 0;
  color: #fff;
  font-size: 24px;
  font-weight: 600;
  line-height: 1.08;
}

.product-detail-hero span,
.product-detail-hero small {
  color: rgba(255, 255, 255, 0.50);
}

.product-detail-price-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
}

.product-detail-price-form > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
}

.product-prices-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.product-prices-form label {
  display: grid;
  gap: 6px;
  color: rgba(255, 255, 255, 0.52);
  font-size: 12px;
  line-height: 1.2;
}

.product-prices-form .input {
  min-height: 42px;
  text-align: center;
  font-weight: 600;
}

.product-prices-form .primary {
  grid-column: 1 / -1;
  min-height: 46px;
}

.product-timeline-stock {
  margin-bottom: 12px;
}

@media (max-width: 430px) {
  .product-prices-form {
    grid-template-columns: 1fr;
  }

  body.home-screen .dashboard-kpis {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  body.home-screen .dashboard-kpi {
    min-height: 82px;
    padding: 10px;
  }

  body.home-screen .dashboard-kpi:nth-child(5) {
    grid-column: auto;
  }

  body.home-screen .dashboard-kpi-icon {
    width: 28px;
    height: 28px;
    margin-bottom: 7px;
  }

  body.home-screen .dashboard-kpi span {
    font-size: 11px;
    line-height: 1.08;
  }

  body.home-screen .dashboard-kpi b {
    font-size: 15px;
    line-height: 1.06;
  }

  .product-compact-card {
    grid-template-columns: 42px minmax(0, 1fr) minmax(62px, auto) 16px;
    gap: 10px;
    min-height: 70px;
    padding: 10px;
  }

  .product-compact-icon {
    width: 42px;
    height: 42px;
    border-radius: 16px;
  }

  .product-compact-main b,
  .product-compact-meta b {
    font-size: 14px;
  }
}

/* Final mobile design guard: keep current style, prevent drift and text overflow */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  font-kerning: normal;
  text-rendering: optimizeLegibility;
}

.app {
  overflow-x: clip;
}

.topbar h1,
#screenTitle,
.section-head b,
.dashboard-user b,
.dashboard-kpi b,
.quick-action-grid button span,
.profile-metric b,
.employee-money-card b,
.product-compact-main b,
.product-compact-meta b,
.event-title b,
.finance-row b,
.team-profile-card b {
  letter-spacing: 0;
  text-wrap: balance;
}

.dashboard-user,
.dashboard-kpi,
.quick-action-grid button,
.primary-action,
.action-item,
.notification-row,
.profile-metric,
.employee-money-card,
.product-compact-card,
.event,
.finance-row,
.warehouse-row,
.team-profile-card,
.profile-install-card {
  min-width: 0;
  isolation: isolate;
}

.dashboard-user > span,
.dashboard-kpi span,
.dashboard-kpi b,
.quick-action-grid button span,
.primary-action h2,
.primary-action p,
.action-item b,
.action-item small,
.notification-row b,
.notification-row small,
.profile-metric span,
.profile-metric b,
.employee-money-card span,
.employee-money-card b,
.employee-money-card small,
.event-title,
.event-meta,
.event-details,
.finance-row > div,
.warehouse-product,
.team-profile-card,
.profile-install-card > div {
  min-width: 0;
}

.dashboard-user small,
.dashboard-user b,
.dashboard-user em,
.section-head span,
.dashboard-kpi span,
.profile-metric span,
.product-compact-main small,
.product-compact-meta small,
.event-meta span,
.finance-row span,
.warehouse-product span,
.profile-install-card span {
  overflow-wrap: anywhere;
}

.dashboard-kpi,
.profile-metric,
.employee-money-card {
  background-clip: padding-box;
  box-shadow:
    0 18px 52px rgba(0, 0, 0, 0.34),
    inset 0 1px 0 rgba(255, 255, 255, 0.055);
}

.priority-actions .quick-action-grid button,
.product-compact-card,
.profile-install-card,
.event,
.finance-row,
.team-profile-card {
  box-shadow:
    0 18px 48px rgba(0, 0, 0, 0.30),
    inset 0 1px 0 rgba(255, 255, 255, 0.06);
}

.tabs {
  max-width: calc(100vw - 32px);
}

.tabs button {
  min-width: 0;
}

.tabs .nav-icon,
.quick-action-icon,
.dashboard-kpi-icon,
.product-compact-icon,
.install-icon {
  flex: 0 0 auto;
}

.profile-install-card {
  align-items: center;
}

.install-actions {
  align-items: center;
}

.stat-core-card {
  position: relative;
  display: grid;
  grid-template-columns: 82px minmax(0, 1fr) auto;
  gap: 13px;
  align-items: center;
  width: 100%;
  min-height: 104px;
  margin: 4px 0 12px;
  padding: 14px;
  overflow: hidden;
  border: 1px solid rgba(167, 139, 250, 0.18);
  border-radius: 28px;
  background:
    radial-gradient(circle at 16% 8%, rgba(124, 58, 237, 0.28), transparent 42%),
    radial-gradient(circle at 86% 22%, rgba(59, 130, 246, 0.16), transparent 36%),
    linear-gradient(145deg, rgba(21, 23, 31, 0.94), rgba(10, 10, 13, 0.92));
  color: var(--text, #fff);
  text-align: left;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.42),
    0 0 44px rgba(124, 58, 237, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.07);
  transform: translateZ(0);
}

.stat-core-card::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(115deg, transparent 0 42%, rgba(255, 255, 255, 0.06) 48%, transparent 55%),
    linear-gradient(to bottom, rgba(255, 255, 255, 0.045), transparent 54%);
  opacity: 0.72;
}

.stat-core-card.watch {
  border-color: rgba(168, 85, 247, 0.24);
}

.stat-core-card.alert {
  border-color: rgba(251, 146, 60, 0.28);
  background:
    radial-gradient(circle at 16% 8%, rgba(251, 146, 60, 0.22), transparent 42%),
    radial-gradient(circle at 86% 22%, rgba(124, 58, 237, 0.20), transparent 36%),
    linear-gradient(145deg, rgba(24, 19, 23, 0.96), rgba(10, 10, 13, 0.92));
}

.stat-core-card:active {
  transform: scale(0.985) translateZ(0);
}

.stat-core-figure {
  position: relative;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  z-index: 1;
}

.stat-core-glow {
  position: absolute;
  inset: 7px;
  border-radius: 28px;
  background: radial-gradient(circle, rgba(168, 85, 247, 0.62), rgba(59, 130, 246, 0.08) 62%, transparent 72%);
  filter: blur(9px);
  opacity: 0.84;
}

.stat-core-orbit {
  position: absolute;
  width: 70px;
  height: 48px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  transform: rotate(-18deg);
  box-shadow: 0 0 24px rgba(124, 58, 237, 0.22);
}

.stat-core-body {
  position: relative;
  display: block;
  width: 58px;
  height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 23px;
  background:
    linear-gradient(150deg, rgba(255, 255, 255, 0.25), transparent 34%),
    linear-gradient(145deg, rgba(91, 141, 255, 0.92), rgba(139, 92, 246, 0.96) 58%, rgba(168, 85, 247, 0.88));
  box-shadow:
    0 18px 42px rgba(99, 102, 241, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.26),
    inset 0 -10px 18px rgba(0, 0, 0, 0.18);
}

.stat-core-eye {
  position: absolute;
  top: 22px;
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.54);
}

.stat-core-eye.left {
  left: 18px;
}

.stat-core-eye.right {
  right: 18px;
}

.stat-core-mouth {
  position: absolute;
  left: 22px;
  bottom: 17px;
  width: 14px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
}

.stat-core-copy {
  position: relative;
  z-index: 1;
  display: grid;
  min-width: 0;
  gap: 2px;
}

.stat-core-copy small,
.stat-core-copy em {
  overflow: hidden;
  color: var(--muted-2, rgba(255, 255, 255, 0.58));
  font-style: normal;
  text-overflow: ellipsis;
}

.stat-core-copy small {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.stat-core-copy b {
  overflow: hidden;
  color: #fff;
  font-size: 21px;
  font-weight: 600;
  line-height: 1.08;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stat-core-copy em {
  display: -webkit-box;
  font-size: 13px;
  line-height: 1.25;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.stat-core-status {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
  min-width: 42px;
  height: 42px;
  padding: 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
}

.stat-core-status svg {
  width: 17px;
  height: 17px;
}

.stat-core-status strong {
  margin-top: 1px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 9px;
  font-weight: 600;
  line-height: 1;
  text-transform: uppercase;
}

@media (hover: hover) {
  .stat-core-card:hover {
    transform: scale(1.01) translateY(-1px);
    border-color: rgba(168, 85, 247, 0.30);
  }
}

@media (prefers-reduced-motion: no-preference) {
  .stat-core-glow {
    animation: stat-core-pulse 3.6s ease-in-out infinite;
  }

  .stat-core-orbit {
    animation: stat-core-float 5.2s ease-in-out infinite;
  }
}

@keyframes stat-core-pulse {
  0%, 100% {
    opacity: 0.62;
    transform: scale(0.96);
  }
  50% {
    opacity: 0.96;
    transform: scale(1.06);
  }
}

@keyframes stat-core-float {
  0%, 100% {
    transform: rotate(-18deg) translateY(0);
  }
  50% {
    transform: rotate(-13deg) translateY(-2px);
  }
}

@media (max-width: 430px) {
  .app {
    padding-inline: 12px;
  }

  .dashboard-head {
    grid-template-columns: minmax(0, 1fr) 54px;
    align-items: center;
  }

  .dashboard-user {
    min-width: 0;
  }

  .stat-core-card {
    grid-template-columns: 70px minmax(0, 1fr) 38px;
    gap: 10px;
    min-height: 92px;
    padding: 12px;
    border-radius: 26px;
  }

  .stat-core-figure {
    width: 66px;
    height: 66px;
  }

  .stat-core-orbit {
    width: 60px;
    height: 42px;
  }

  .stat-core-body {
    width: 50px;
    height: 50px;
    border-radius: 20px;
  }

  .stat-core-eye {
    top: 19px;
    width: 6px;
    height: 6px;
  }

  .stat-core-eye.left {
    left: 16px;
  }

  .stat-core-eye.right {
    right: 16px;
  }

  .stat-core-mouth {
    left: 19px;
    bottom: 15px;
    width: 12px;
  }

  .stat-core-copy b {
    font-size: 18px;
  }

  .stat-core-copy em {
    font-size: 12px;
  }

  .stat-core-status {
    min-width: 36px;
    height: 36px;
    border-radius: 14px;
  }

  body.home-screen .dashboard-kpis {
    gap: 8px;
  }

  body.home-screen .dashboard-kpi {
    border-radius: 22px;
  }

  .priority-actions .quick-action-grid {
    gap: 10px;
  }

  .priority-actions .quick-action-grid button {
    grid-template-rows: 42px minmax(32px, auto);
    min-height: 108px;
    border-radius: 25px;
  }

  .priority-actions .quick-action-grid button span {
    overflow-wrap: anywhere;
  }

  .primary-action h2 {
    font-size: clamp(28px, 8.2vw, 36px);
  }

  .profile-metric-row {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

  .profile-focus-grid,
  .finance-grid,
  .compact-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .profile-install-card {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .install-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .product-compact-card {
    grid-template-columns: 42px minmax(0, 1fr) minmax(56px, auto) 16px;
  }
}

@media (max-width: 360px) {
  .profile-metric-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  body.home-screen .dashboard-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .stat-core-card {
    grid-template-columns: 58px minmax(0, 1fr);
  }

  .stat-core-status {
    display: none;
  }

  .stat-core-figure {
    width: 54px;
    height: 54px;
  }

  .stat-core-body {
    width: 44px;
    height: 44px;
    border-radius: 18px;
  }

  .tabs {
    max-width: calc(100vw - 20px);
    padding-inline: 6px;
  }
}

/* Final readability pass: product cards, notifications, profile install and team profile */
body[data-screen="stock"] .product-compact-card,
body.stock-screen .product-compact-card {
  grid-template-columns: 48px minmax(0, 1fr) 18px !important;
  grid-template-rows: auto auto !important;
  grid-template-areas:
    "icon main arrow"
    "icon meta arrow" !important;
  align-items: center !important;
  gap: 8px 12px !important;
  min-height: 86px !important;
  padding: 12px !important;
  border-radius: 24px !important;
}

body[data-screen="stock"] .product-compact-icon,
body.stock-screen .product-compact-icon {
  grid-area: icon !important;
  width: 48px !important;
  height: 48px !important;
  border-radius: 18px !important;
}

body[data-screen="stock"] .product-compact-main,
body.stock-screen .product-compact-main {
  grid-area: main !important;
  align-self: end !important;
  min-width: 0 !important;
}

body[data-screen="stock"] .product-compact-meta,
body.stock-screen .product-compact-meta {
  grid-area: meta !important;
  align-self: start !important;
  display: flex !important;
  flex-wrap: wrap !important;
  gap: 4px 8px !important;
  text-align: left !important;
}

body[data-screen="stock"] .product-compact-card > i,
body.stock-screen .product-compact-card > i {
  grid-area: arrow !important;
  align-self: center !important;
  justify-self: end !important;
}

body[data-screen="stock"] .product-compact-main b,
body.stock-screen .product-compact-main b {
  display: -webkit-box !important;
  overflow: hidden !important;
  color: #fff !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  line-height: 1.16 !important;
  white-space: normal !important;
  -webkit-box-orient: vertical !important;
  -webkit-line-clamp: 2 !important;
}

body[data-screen="stock"] .product-compact-main small,
body[data-screen="stock"] .product-compact-meta small,
body.stock-screen .product-compact-main small,
body.stock-screen .product-compact-meta small {
  display: block !important;
  overflow: hidden !important;
  max-width: 100% !important;
  color: rgba(255, 255, 255, 0.52) !important;
  font-size: 12px !important;
  line-height: 1.22 !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

body[data-screen="stock"] .product-compact-meta b,
body.stock-screen .product-compact-meta b {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  align-items: center !important;
  min-height: 24px !important;
  padding: 2px 8px !important;
  border: 1px solid rgba(167, 139, 250, 0.18) !important;
  border-radius: 999px !important;
  background: rgba(139, 92, 246, 0.12) !important;
  color: #fff !important;
  font-size: 12px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.product-min-note {
  display: inline-flex !important;
  flex: 0 0 auto !important;
  align-items: center !important;
  min-height: 24px !important;
  padding: 2px 8px !important;
  border: 1px solid rgba(255, 255, 255, 0.075) !important;
  border-radius: 999px !important;
  background: rgba(255, 255, 255, 0.055) !important;
  color: rgba(255, 255, 255, 0.66) !important;
  font-size: 11px !important;
  font-style: normal !important;
  font-weight: 600 !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

body[data-screen="stock"] .product-compact-meta small,
body.stock-screen .product-compact-meta small {
  flex: 1 1 160px !important;
  margin-top: 0 !important;
}

body.notifications-screen .period-switch,
body[data-screen="notifications"] .period-switch,
#notificationFilters {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
  width: 100% !important;
  max-width: 100% !important;
  margin: 10px 0 12px !important;
  padding: 7px !important;
  overflow: hidden !important;
  border-radius: 28px !important;
}

body.notifications-screen .period-switch button,
body[data-screen="notifications"] .period-switch button,
#notificationFilters button {
  display: grid !important;
  place-items: center !important;
  min-width: 0 !important;
  min-height: 44px !important;
  padding: 0 8px !important;
  overflow: hidden !important;
  border-radius: 22px !important;
  font-size: 14px !important;
  line-height: 1 !important;
  text-align: center !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.profile-install-card {
  grid-template-columns: 52px minmax(0, 1fr) auto !important;
  overflow: hidden !important;
}

.profile-install-card .install-icon {
  display: grid !important;
  place-items: center !important;
  width: 52px !important;
  height: 52px !important;
  min-width: 52px !important;
  overflow: hidden !important;
  border: 1px solid rgba(255, 255, 255, 0.08) !important;
  border-radius: 19px !important;
  background:
    radial-gradient(circle at 20% 0%, rgba(96, 165, 250, 0.16), transparent 58%),
    rgba(255, 255, 255, 0.06) !important;
}

.profile-install-card .install-card-icon {
  width: 22px !important;
  height: 22px !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  color: rgba(255, 255, 255, 0.74) !important;
}

.team-profile-body {
  min-height: 0 !important;
  padding: 12px !important;
  border: 1px solid rgba(255, 255, 255, 0.075) !important;
  border-radius: 28px !important;
  background: rgba(255, 255, 255, 0.045) !important;
  box-shadow: var(--shadow) !important;
}

.team-profile-body .compact-metrics {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  gap: 8px !important;
}

.team-profile-body .compact-metrics > div {
  display: grid !important;
  align-content: center !important;
  min-height: 78px !important;
  padding: 12px !important;
  border-radius: 20px !important;
}

.team-profile-body .compact-metrics span,
.team-profile-body .compact-metrics b {
  text-align: left !important;
}

.team-profile-body .compact-metrics b {
  overflow-wrap: normal !important;
  word-break: normal !important;
  font-size: clamp(18px, 5vw, 24px) !important;
  line-height: 1.05 !important;
}

@media (max-width: 430px) {
  .profile-install-card {
    grid-template-columns: 52px minmax(0, 1fr) !important;
  }

  .profile-install-card .install-actions {
    grid-column: 1 / -1 !important;
  }
}

@media (max-width: 370px) {
  body[data-screen="stock"] .product-compact-card,
  body.stock-screen .product-compact-card {
    grid-template-columns: 44px minmax(0, 1fr) 16px !important;
    gap: 7px 9px !important;
  }

  body[data-screen="stock"] .product-compact-icon,
  body.stock-screen .product-compact-icon {
    width: 44px !important;
    height: 44px !important;
  }
}

.sale-cost-action {
  justify-self: flex-start;
  min-height: 32px;
  margin-top: 6px;
  color: #c9a8ff;
}

.cost-permission-section {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.cost-permission-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  min-width: 0;
  max-width: 100%;
}

.cost-permission-form label,
.cost-permission-form button,
.cost-permission-form .input,
.cost-permission-form .select {
  min-width: 0;
  max-width: 100%;
}

.cost-permission-form label:first-child,
.cost-permission-form label:last-of-type,
.cost-permission-form button,
.cost-coupon-note {
  grid-column: 1 / -1;
}

.cost-coupon-note {
  display: grid;
  gap: 4px;
  padding: 12px 14px;
  border: 1px solid rgba(165, 116, 255, 0.22);
  border-radius: 18px;
  background:
    radial-gradient(circle at 12% 0%, rgba(124, 92, 255, 0.18), transparent 130px),
    rgba(255, 255, 255, 0.045);
}

.cost-coupon-note b {
  color: var(--vs-text);
  font-size: 14px;
  font-weight: 600;
}

.cost-coupon-note span {
  color: var(--vs-text-muted);
  font-size: 12px;
  line-height: 1.35;
}

.cost-permission-list {
  display: grid;
  gap: 8px;
}

.cost-permission-list article {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px 10px;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.075);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
}

.cost-permission-list article > div {
  min-width: 0;
}

.cost-permission-list article b,
.cost-permission-list article span,
.cost-permission-list article small {
  overflow-wrap: anywhere;
}

.cost-permission-list article > small {
  color: var(--vs-text-muted);
  font-size: 11px;
}

.cost-permission-list article > button {
  grid-row: span 2;
}
