:root {
  color-scheme: light;
  --bg: #ece5d7;
  --bg-accent: #f6f1e7;
  --surface: rgba(250, 247, 240, 0.92);
  --surface-strong: #fcfaf4;
  --surface-soft: rgba(240, 235, 226, 0.88);
  --auth-surface: rgba(255, 251, 245, 0.92);
  --border: rgba(97, 83, 57, 0.12);
  --text: #22303a;
  --muted: #6f7268;
  --accent: #415b49;
  --accent-strong: #2a4032;
  --warm: #a85629;
  --warning: #ac6b30;
  --danger: #a14b40;
  --shadow: 0 18px 40px rgba(56, 48, 34, 0.08);
  --shadow-strong: 0 24px 60px rgba(56, 48, 34, 0.12);
  --radius-lg: 24px;
  --radius-md: 18px;
  --radius-sm: 14px;
  --font-heading: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-body: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
}

/* ── Native App Feel ── */
html {
  -webkit-tap-highlight-color: transparent;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
}

body {
  overscroll-behavior: none;
  -webkit-user-select: none;
  user-select: none;
  touch-action: manipulation;
}

/* Re-enable selection for content the user needs to copy */
input, textarea, [contenteditable], .item-name, .item-notes, .comment-body {
  -webkit-user-select: text;
  user-select: text;
}

/* Smooth scrollable containers with momentum */
.department-card, .app-workspace, .inventory-list, .items-list {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-y: contain;
}

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation-duration: 0.2s;
  }
}

* {
  box-sizing: border-box;
}

[hidden],
.hidden {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-synthesis: none;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.72), transparent 26%),
    radial-gradient(circle at bottom right, rgba(233, 223, 204, 0.9), transparent 28%),
    linear-gradient(180deg, #f3ede2 0%, var(--bg) 100%);
}

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

button {
  cursor: pointer;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.88);
  padding: 0.7rem 0.8rem;
  color: var(--text);
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.5);
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: rgba(53, 95, 58, 0.55);
  box-shadow: 0 0 0 4px rgba(53, 95, 58, 0.12);
}

textarea {
  resize: vertical;
}

label {
  display: grid;
  gap: 0.35rem;
  font-size: 0.88rem;
  color: var(--muted);
}

h1,
h2,
h3,
h4,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  font-family: var(--font-heading);
  font-weight: 750;
  letter-spacing: -0.015em;
  line-height: 1.08;
}

h1 {
  font-size: clamp(1.9rem, 4vw, 3.3rem);
  margin-bottom: 0.45rem;
}

h2 {
  font-size: 1.18rem;
}

.eyebrow,
.panel-kicker,
.card-label {
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.66rem;
  color: var(--accent);
}

.subtext,
.summary-note,
.hero-copy,
.auth-copy {
  color: var(--muted);
  line-height: 1.45;
}

.helper,
.provider-message,
.message {
  line-height: 1.4;
}

.helper,
.provider-message,
.summary-note {
  font-size: 0.88rem;
}

.message {
  min-height: 1.35rem;
  margin: 0.85rem 0 0;
  color: var(--muted);
}

.message.error {
  color: var(--danger);
}

.message.success {
  color: var(--accent-strong);
}

.auth-shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 0.35rem;
  background:
    radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.56), transparent 34%),
    linear-gradient(180deg, #e8e1d2 0%, #eee6d8 100%);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.compact-brand {
  margin-bottom: 0.55rem;
}

.brand-mark {
  width: 3rem;
  height: 3rem;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: var(--accent-strong);
  background: #f5ad4f;
  border-radius: 0.65rem;
  box-shadow: 0 12px 24px rgba(56, 48, 34, 0.12);
}

.brand-logo,
.warekenn-logo-svg {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.small-mark {
  width: 2.45rem;
  height: 2.45rem;
}

.brand-tagline {
  margin: 0;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.15;
}

.auth-panel {
  width: min(294px, calc(100% - 0.5rem));
}

.auth-card {
  width: 100%;
  padding: 1.1rem 1rem 0.95rem;
  border: 1px solid rgba(63, 78, 54, 0.08);
  border-radius: 18px;
  background: #fffbf4;
  box-shadow: 0 18px 42px rgba(56, 48, 34, 0.14);
}

.auth-back-button {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  border: 0;
  margin: 0 0 0.75rem;
  padding: 0;
  color: var(--muted);
  background: transparent;
  font-size: 0.82rem;
  font-weight: 800;
}

.auth-logo-wrap {
  display: flex;
  justify-content: center;
  margin: 0.05rem 0 0.7rem;
}

.auth-mark {
  width: 4.25rem;
  height: 4.25rem;
  box-shadow: none;
}

.auth-card h2 {
  margin: 0 0 0.35rem;
  color: var(--text);
  font-size: 1.38rem;
  line-height: 1.08;
  text-align: center;
}

.auth-card .subtext {
  margin: 0 0 1rem;
  color: var(--muted);
  line-height: 1.35;
  text-align: center;
}

.auth-card form {
  display: grid;
}

.auth-card label {
  margin: 0.35rem 0 0.12rem;
  color: var(--text);
  font-weight: 600;
  font-size: 0.78rem;
  line-height: 1.15;
}

.auth-card input {
  min-height: 48px;
  border-radius: 14px;
  border-color: #e3dccb;
  background: #f7f3e9;
  color: var(--text);
  padding: 0.72rem 0.8rem;
  box-shadow: none;
}

.auth-card input:focus {
  border-color: rgba(53, 95, 58, 0.5);
  box-shadow: 0 0 0 3px rgba(53, 95, 58, 0.14);
}

.password-field {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 48px;
  gap: 0.45rem;
  align-items: center;
}

.password-toggle {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid #e5dfd5;
  border-radius: 14px;
  color: var(--muted);
  background: #fffdf8;
}

.password-toggle svg {
  width: 18px;
  height: 18px;
}

.auth-card .link-button {
  justify-self: start;
  margin-top: 0.35rem;
  color: var(--accent);
  font-size: 0.8rem;
}

.auth-card .message {
  min-height: 1.1rem;
  margin: 0.25rem 0 0;
  font-size: 0.78rem;
}

.auth-card .primary-button {
  justify-self: stretch;
  min-height: 48px;
  margin-top: 0.85rem;
  border-radius: 12px;
  padding: 0.8rem 0.95rem;
  color: #f7f7f1;
  background: linear-gradient(135deg, #516c58, var(--accent-strong));
  box-shadow: 0 10px 22px rgba(42, 64, 50, 0.18);
  font-size: 0.9rem;
}

.auth-card .divider {
  margin: 1.15rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.8rem;
}

.auth-card .divider::before,
.auth-card .divider::after {
  background: #e5dfd5;
}

.auth-card .social-grid {
  gap: 0.6rem;
}

.auth-card .social-button {
  min-height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  border: 1px solid #e5dfd5;
  border-radius: 14px;
  padding: 0.7rem 0.9rem;
  color: #4d5a50;
  background: #fff;
  box-shadow: none;
  font-weight: 700;
}

.google-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  display: block;
}

.apple-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  color: #111827;
  display: block;
}

.apple-button {
  color: #111827;
}

.microsoft-icon {
  width: 14px;
  height: 14px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
}

.microsoft-icon span:nth-child(1) {
  background: #f25022;
}

.microsoft-icon span:nth-child(2) {
  background: #7fba00;
}

.microsoft-icon span:nth-child(3) {
  background: #00a4ef;
}

.microsoft-icon span:nth-child(4) {
  background: #ffb900;
}

.auth-switcher {
  margin: 0.75rem 0 0;
  color: var(--muted);
  text-align: center;
}

.auth-inline-button {
  border: 0;
  padding: 0;
  color: var(--accent-strong);
  background: transparent;
  font-weight: 800;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.company-mode-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.45rem;
  margin: 0.55rem 0 0.25rem;
}

.company-mode-button {
  min-height: 38px;
  border: 1px solid #e5dfd5;
  border-radius: 12px;
  padding: 0.52rem 0.5rem;
  background: #fffdf8;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.78rem;
}

.company-mode-button.is-active {
  color: #f7f7f1;
  background: var(--accent-strong);
  border-color: var(--accent-strong);
}

.auth-card .helper {
  margin: 0.3rem 0 0.2rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid #e5dfd5;
  border-radius: 12px;
  color: var(--muted);
  background: #fff9ee;
  font-size: 0.78rem;
}

.auth-card .provider-message {
  margin: 0.6rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
  text-align: center;
}

.auth-card .provider-message:empty {
  display: none;
}

.sync-status {
  border-color: rgba(53, 95, 58, 0.16);
}

.sync-status.synced {
  color: var(--accent-strong);
  background: rgba(53, 95, 58, 0.12);
}

.sync-status.syncing,
.sync-status.pending {
  color: var(--warm);
  background: rgba(168, 86, 41, 0.12);
}

.sync-status.offline {
  color: var(--muted);
  background: rgba(39, 49, 38, 0.08);
}

.invite-banner,
.status-banner,
.locked-panel {
  border-radius: var(--radius-lg);
  padding: 0.9rem 1rem;
}

.invite-banner {
  margin-bottom: 0.8rem;
  background: rgba(168, 86, 41, 0.12);
  color: var(--warm);
}

.divider {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin: 1rem 0 0.85rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.divider::before,
.divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.social-grid {
  display: grid;
  gap: 0.7rem;
}

.social-button {
  border: 1px solid rgba(53, 95, 58, 0.14);
  border-radius: 999px;
  padding: 0.7rem 0.9rem;
  color: var(--accent-strong);
  font-weight: 700;
  background: rgba(255, 255, 255, 0.86);
}

.social-button:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.link-button {
  width: max-content;
  border: 0;
  padding: 0.3rem 0;
  margin-top: 0.35rem;
  color: var(--accent-strong);
  background: transparent;
  font-weight: 700;
  text-align: left;
}

.link-button:hover {
  text-decoration: underline;
}

.password-reset-panel {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(97, 83, 57, 0.1);
}

.password-reset-panel .form-actions {
  margin-top: 0.8rem;
}

.quick-notes {
  display: grid;
  gap: 0.7rem;
  margin-top: 1.4rem;
}

.quick-note {
  margin: 0;
  padding: 0.85rem 0.95rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(63, 78, 54, 0.1);
  background: rgba(255, 255, 255, 0.56);
  box-shadow: var(--shadow);
}

#import-file {
  display: none;
}

.page-shell {
  width: min(1180px, calc(100% - 1.25rem));
  margin: 0 auto;
  padding: 1rem 0 1.75rem;
}

.hero,
.panel {
  border: 1px solid rgba(97, 83, 57, 0.08);
  border-radius: 30px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero {
  display: flex;
  justify-content: space-between;
  gap: 1.2rem;
  padding: 0.85rem 0.95rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(250, 247, 240, 0.94)),
    linear-gradient(120deg, rgba(242, 236, 225, 0.42), rgba(255, 255, 255, 0));
  align-items: center;
  border-radius: 22px;
}

.hero-main {
  display: grid;
  gap: 0.45rem;
  min-width: 0;
}

.hero-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.hero-title-row h1 {
  margin: 0;
  font-size: 1.35rem;
  line-height: 1.05;
}

.hero-company {
  margin: 0.12rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.2;
}

.hero-meta {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.hero-meta-pill {
  display: inline-flex;
  margin: 0;
  padding: 0.28rem 0.56rem;
  border-radius: 999px;
  background: rgba(65, 91, 73, 0.08);
  color: var(--accent-strong);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.05em;
}

.subtle-badge {
  background: rgba(168, 86, 41, 0.12);
  color: var(--warm);
}

.hero-copy {
  max-width: 36rem;
  margin: 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.25;
}

.hero-actions {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
}

.layout,
.management-grid,
.summary-grid {
  display: grid;
  gap: 0.75rem;
}

.product-editor-header {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.9rem;
}

#product-editor-view {
  margin-top: 0.75rem;
}

.page-header-panel {
  padding: 1rem;
  background: var(--surface);
}

.page-header-panel {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
}

.summary-grid {
  margin-top: 0.75rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.summary-card {
  padding: 0.9rem;
}

.summary-card p:last-child {
  margin-bottom: 0;
}

.status-banner {
  margin-top: 0.75rem;
  background: rgba(53, 95, 58, 0.1);
  color: var(--accent-strong);
}

.status-banner.pending {
  background: rgba(168, 86, 41, 0.12);
  color: var(--warm);
}

.status-banner.neutral {
  background: rgba(39, 49, 38, 0.07);
  color: var(--muted);
}

.status-banner.error {
  background: rgba(193, 87, 63, 0.12);
  color: var(--danger);
}

.management-view {
  margin-top: 0.75rem;
}

.management-header,
.management-panel,
.department-panel,
.form-panel,
.department-card,
.empty-departments,
.stat-card,
.locked-panel {
  padding: 0.9rem;
  background: var(--surface);
}

.management-header {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: start;
}

.management-grid {
  margin-top: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.management-disclosure {
  display: grid;
  gap: 0.75rem;
}

.management-disclosure summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  cursor: pointer;
  list-style: none;
}

.management-disclosure summary::-webkit-details-marker {
  display: none;
}

.management-disclosure summary > span:first-child {
  display: grid;
  gap: 0.18rem;
}

.management-disclosure strong {
  font-family: var(--font-heading);
  font-size: 1.04rem;
  color: var(--text);
}

.management-disclosure .summary-note {
  display: block;
  margin: 0;
}

.management-disclosure-body {
  margin-top: 0.8rem;
}

.disclosure-icon {
  width: 2.15rem;
  height: 2.15rem;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 12px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid rgba(97, 83, 57, 0.12);
}

.disclosure-icon::before {
  content: "+";
  font-size: 1.2rem;
  line-height: 1;
}

.management-disclosure[open] .disclosure-icon::before {
  content: "-";
}

.account-panel {
  position: relative;
  padding-right: 3.7rem;
  border-color: rgba(161, 75, 64, 0.14);
  background:
    linear-gradient(160deg, rgba(255, 246, 241, 0.96), rgba(255, 252, 246, 0.88));
}

.destructive-icon-button {
  width: 2.45rem;
  height: 2.45rem;
  display: inline-grid;
  place-items: center;
  padding: 0;
  border-radius: 14px;
}

.account-panel .destructive-icon-button {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
}

.checkbox-grid,
.stack-list {
  display: grid;
  gap: 0.55rem;
}

.checkbox-item,
.stack-card,
.invite-preview {
  border-radius: var(--radius-md);
  border: 1px solid rgba(63, 78, 54, 0.1);
  background: rgba(255, 255, 255, 0.74);
}

.checkbox-item {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  padding: 0.7rem 0.8rem;
}

.checkbox-item input {
  width: auto;
  margin: 0;
}

.stack-card {
  padding: 0.8rem;
}

.stack-card-heading,
.stack-card-actions,
.meta-list {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.stack-card-heading {
  justify-content: space-between;
}

.stack-card-actions {
  margin-top: 0.75rem;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  width: max-content;
  min-height: 1.45rem;
  margin-left: 0.35rem;
  padding: 0.22rem 0.52rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  color: var(--muted);
  background: rgba(39, 49, 38, 0.08);
}

.invite-status-pending,
.approval-status-pending {
  color: var(--warm);
  background: rgba(168, 86, 41, 0.12);
}

.invite-status-accepted,
.approval-status-approved {
  color: var(--accent-strong);
  background: rgba(53, 95, 58, 0.12);
}

.invite-status-expired,
.invite-status-cancelled,
.approval-status-rejected {
  color: var(--danger);
  background: rgba(193, 87, 63, 0.12);
}

.meta-list {
  margin-top: 0.65rem;
}

.meta-item {
  display: inline-grid;
  gap: 0.12rem;
  padding: 0.42rem 0.55rem;
  border-radius: var(--radius-sm);
  background: rgba(240, 235, 226, 0.75);
  color: var(--muted);
  font-size: 0.72rem;
}

.meta-item strong {
  color: var(--text);
  font-size: 0.78rem;
}

.approval-department-preview {
  margin: 0.65rem 0 0;
  color: var(--muted);
  font-size: 0.86rem;
}

.invite-link {
  margin-top: 0.65rem;
}

.department-management-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.stack-card p:last-child {
  margin-bottom: 0;
}

.stack-card label {
  margin-top: 0.75rem;
}

.approval-message {
  margin-top: 0.6rem;
}

.invite-preview {
  margin-top: 0.95rem;
  padding: 0.8rem;
  border-style: dashed;
}

.invite-preview a,
.stack-card a {
  color: var(--accent-strong);
  word-break: break-word;
}

.locked-panel {
  background:
    linear-gradient(160deg, rgba(255, 244, 235, 0.98), rgba(255, 252, 246, 0.88));
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}

.quick-action-panel {
  display: grid;
  gap: 0.9rem;
  padding: 0.85rem 0.9rem;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.82), rgba(250, 247, 240, 0.94));
}

.quick-action-header,
.dropdown-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.9rem;
}

.quick-action-panel h2 {
  margin-bottom: 0;
}

.department-dropdown {
  padding: 0.95rem;
  border-radius: 18px;
  border: 1px solid rgba(97, 83, 57, 0.12);
  background:
    linear-gradient(180deg, rgba(255, 252, 246, 0.98), rgba(250, 247, 240, 0.96));
  box-shadow: 0 18px 34px rgba(56, 48, 34, 0.1);
}

.dropdown-panel-header {
  margin-bottom: 0.85rem;
}

.dropdown-panel-header .modal-close-button {
  position: static;
  flex: 0 0 auto;
}

.dropdown-form {
  display: grid;
  gap: 0.75rem;
}

.optional-label {
  color: var(--muted);
  font-weight: 600;
}

.member-email-editor {
  display: grid;
  gap: 0.45rem;
}

.member-email-row {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: minmax(0, 1fr) auto;
}

.member-email-list {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  min-height: 1.7rem;
}

.member-email-list .muted {
  margin: 0;
  font-size: 0.82rem;
}

.member-email-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.28rem 0.42rem 0.28rem 0.58rem;
  border-radius: 999px;
  color: var(--accent-strong);
  background: rgba(65, 91, 73, 0.1);
  font-size: 0.82rem;
  font-weight: 700;
}

.member-email-chip button {
  width: 1.35rem;
  height: 1.35rem;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  color: inherit;
  background: rgba(255, 255, 255, 0.7);
  font-weight: 800;
  line-height: 1;
}

.dropdown-actions {
  justify-content: flex-end;
}

.department-note {
  margin-bottom: 0;
}

.department-form,
.form-row {
  display: grid;
  gap: 0.7rem;
  grid-template-columns: minmax(0, 1fr) auto;
}

.inventory-form {
  display: grid;
  gap: 0.7rem;
}

.barcode-code-field input {
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 0.04em;
  background: rgba(255, 255, 255, 0.55);
}

.product-department-context {
  margin-top: 0.2rem;
}

.department-chip-list {
  display: grid;
  gap: 0.55rem;
  margin-top: 0.75rem;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.department-chip {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  align-items: center;
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(97, 83, 57, 0.08);
  background: rgba(255, 255, 255, 0.5);
}

.department-chip-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.department-chip-title {
  margin-bottom: 0.18rem;
  font-size: 0.98rem;
}

.department-chip-copy {
  margin: 0;
  color: var(--muted);
}

.form-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.primary-button,
.ghost-button,
.danger-button,
.file-button,
.icon-button,
.sort-option {
  border: 0;
  border-radius: 999px;
  padding: 0.52rem 0.82rem;
  font-weight: 700;
  font-size: 0.84rem;
  line-height: 1.1;
  transition: transform 180ms ease, box-shadow 180ms ease, background 180ms ease, border-color 180ms ease;
}

.nav-link-button {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.icon-text-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.toolbar-button {
  width: 2.65rem;
  height: 2.65rem;
  display: inline-grid;
  place-items: center;
  flex: 0 0 auto;
  padding: 0;
  border-radius: 14px;
  position: relative;
}

.toolbar-button .nav-action-label {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.toolbar-button.labeled-toolbar-button {
  width: auto;
  display: inline-flex;
  gap: 0.45rem;
  padding: 0 0.78rem;
  border-radius: 999px;
}

.toolbar-button.labeled-toolbar-button .nav-action-label {
  position: static;
  width: auto;
  height: auto;
  padding: 0;
  margin: 0;
  overflow: visible;
  clip: auto;
  white-space: nowrap;
}

.button-icon {
  width: 1.15rem;
  height: 1.15rem;
  display: block;
  flex: 0 0 auto;
}

.primary-button {
  color: #f7f7f1;
  background: linear-gradient(135deg, #516c58, var(--accent-strong));
  box-shadow: 0 10px 22px rgba(42, 64, 50, 0.18);
}

.ghost-button,
.file-button,
.icon-button {
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.8);
  border: 1px solid rgba(97, 83, 57, 0.12);
  box-shadow: 0 6px 14px rgba(56, 48, 34, 0.06);
}

.danger-button {
  color: #fff7f4;
  background: linear-gradient(135deg, #c1573f, var(--danger));
  box-shadow: 0 10px 20px rgba(138, 74, 59, 0.14);
}

.sort-option {
  padding: 0.5rem 0.72rem;
  border-radius: var(--radius-sm);
  text-align: left;
  background: transparent;
  color: var(--text);
}

.sort-option:hover {
  background: rgba(240, 235, 226, 0.9);
}

.small-button,
.icon-button {
  padding: 0.42rem 0.68rem;
  font-size: 0.78rem;
}

.tiny-button {
  padding: 0.32rem 0.55rem;
  font-size: 0.72rem;
}

.small-icon-button {
  width: 2.2rem;
  height: 2.2rem;
  padding: 0;
  border-radius: 12px;
}

.danger-button.destructive-icon-button,
.small-button.destructive-icon-button {
  width: 2.45rem;
  height: 2.45rem;
  padding: 0;
}

.primary-button:hover,
.ghost-button:hover,
.danger-button:hover,
.file-button:hover,
.icon-button:hover,
.social-button:hover {
  transform: translateY(-1px);
}

.stats-grid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.stat-card h2 {
  font-size: 2.1rem;
  margin: 0.1rem 0 0.2rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

.stat-card p:last-child {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
}

.alert-card {
  background:
    linear-gradient(160deg, rgba(255, 243, 233, 0.98), rgba(255, 249, 241, 0.92));
}

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

.department-card-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.department-subtitle {
  margin: 0.3rem 0 0;
  color: rgba(34, 48, 58, 0.62);
  line-height: 1.25;
  font-size: 0.84rem;
}

.department-heading-copy {
  display: grid;
  gap: 0.18rem;
}

.department-back-button {
  width: 2rem;
  height: 2rem;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: rgba(34, 48, 58, 0.56);
  text-indent: -9999px;
  position: relative;
}

.department-back-button::before {
  content: "\2190";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-indent: 0;
  font-size: 1.1rem;
}

.department-header-actions {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.department-toolbar {
  display: flex;
  gap: 0.7rem;
  align-items: center;
  margin-bottom: 1rem;
}

.room-search {
  flex: 1;
}

.room-search input {
  min-height: 2.7rem;
  padding-left: 2.6rem;
  border-radius: 16px;
  border-color: rgba(53, 95, 58, 0.34);
  background: #5d7d64;
  color: #f7faf5;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.16);
}

.room-search input::placeholder {
  color: rgba(247, 250, 245, 0.72);
}

.room-search {
  position: relative;
}

.room-search::before {
  content: "\2315";
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: rgba(247, 250, 245, 0.78);
  font-size: 1rem;
  pointer-events: none;
}

.room-filter-button {
  min-height: 2.7rem;
  min-width: 7rem;
  justify-content: center;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.76);
}

.room-filter-button::before {
  content: "\25CE";
  margin-right: 0.45rem;
  font-size: 0.85rem;
}

.room-filter-button::after {
  content: "\2304";
  margin-left: 0.45rem;
  font-size: 0.72rem;
}

.room-add-button {
  min-height: 2.6rem;
  padding: 0.58rem 1rem;
  border-radius: 16px;
  background: var(--accent-strong);
  box-shadow: none;
}

.room-add-button::before {
  content: "+";
  margin-right: 0.45rem;
}

.room-icon-button {
  width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border-radius: 16px;
}

.room-label-button {
  min-height: 2.6rem;
  padding: 0.58rem 0.9rem;
  border-radius: 16px;
}

.scan-button {
  text-indent: -9999px;
  position: relative;
}

.scan-button::before {
  content: "\25A3";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-indent: 0;
  font-size: 1rem;
}

.sort-menu {
  position: relative;
}

.sort-menu-panel {
  position: absolute;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 2;
  display: grid;
  gap: 0.3rem;
  min-width: 8rem;
  padding: 0.35rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(97, 83, 57, 0.1);
  background: rgba(255, 252, 246, 0.98);
  box-shadow: 0 18px 30px rgba(56, 48, 34, 0.12);
}

.department-card-list {
  display: grid;
  gap: 0.85rem;
}

.item-card {
  padding: 0.95rem;
  border: 1px solid rgba(42, 64, 50, 0.4);
  border-radius: 22px;
  background: linear-gradient(180deg, #4b6a53 0%, #3c5743 100%);
  box-shadow: 0 14px 30px rgba(42, 64, 50, 0.22);
  color: #f4f8f2;
}

.item-card.is-highlighted {
  border-color: #8fbf97;
  box-shadow: 0 0 0 3px rgba(120, 176, 134, 0.3), 0 14px 30px rgba(42, 64, 50, 0.22);
}

.item-card.is-readonly {
  background: linear-gradient(180deg, #6e8672 0%, #5f7763 100%);
}

.item-card-header {
  display: flex;
  justify-content: space-between;
  gap: 0.7rem;
  align-items: start;
  margin-bottom: 0.85rem;
}

.item-card-tools {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  justify-content: end;
}

.item-name {
  font-size: 1.02rem;
  margin-bottom: 0.2rem;
  color: #f4f8f2;
}

.item-location,
.item-barcode,
.item-notes {
  margin: 0;
  color: rgba(244, 248, 242, 0.82);
  line-height: 1.3;
  font-size: 0.84rem;
}

.item-barcode {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
}

.item-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.55rem;
}

.item-section-header h4 {
  font-size: 0.9rem;
  margin: 0;
}

.comment-panel-header {
  align-items: start;
}

.comment-panel-summary {
  margin: 0.18rem 0 0;
  color: rgba(244, 248, 242, 0.76);
  font-size: 0.78rem;
}

.item-location-board {
  margin-top: 0.2rem;
  padding: 0;
  border-radius: 0;
  background: transparent;
  border: 0;
}

.location-list {
  display: grid;
  gap: 0.55rem;
}

.location-row {
  padding: 0;
  border-radius: 0;
  border: 0;
  background: transparent;
  box-shadow: none;
}

.location-row-main {
  display: flex;
  align-items: start;
  gap: 0.6rem;
}

.location-row-info {
  display: grid;
  gap: 0.18rem;
}

.location-row-kicker {
  margin: 0 0 0.2rem;
  font-size: 0.92rem;
  color: rgba(244, 248, 242, 0.7);
}

.location-row-name {
  font-size: 1.02rem;
  margin: 0;
  color: #f4f8f2;
}

.location-quantity-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.8rem;
  padding: 0.2rem 0.45rem;
  border-radius: 14px;
  color: #f4f8f2;
  font-weight: 700;
  white-space: nowrap;
  font-size: 2rem;
  line-height: 1;
}

.location-row-actions,
.inline-edit-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.location-row-actions {
  margin-top: 1rem;
  align-items: center;
  justify-content: flex-start;
  gap: 0.8rem;
}

.location-quick-adjust {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  flex-wrap: wrap;
}

.item-actions {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  margin-top: 0.95rem;
  padding-top: 0.75rem;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.comment-icon-button {
  position: relative;
  width: 2.25rem;
  min-width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  display: inline-grid;
  place-items: center;
}

.comment-icon-button .button-icon {
  width: 1.08rem;
  height: 1.08rem;
}

.comment-count-badge {
  position: absolute;
  top: -0.48rem;
  right: -0.48rem;
  min-width: 1.2rem;
  height: 1.2rem;
  display: inline-grid;
  place-items: center;
  padding: 0 0.28rem;
  border-radius: 999px;
  border: 2px solid rgba(247, 250, 245, 0.88);
  color: #ffffff;
  background: #a85629;
  font-size: 0.72rem;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 6px 12px rgba(86, 46, 18, 0.26);
}

.comment-count-badge[hidden] {
  display: none;
}

.quantity-adjust-panel,
.move-location-panel,
.inline-edit-panel,
.add-location-panel,
.item-comments-panel {
  margin-top: 0.6rem;
  padding: 0.7rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.14);
}

.item-card .ghost-button,
.item-card .icon-button,
.item-card .danger-button,
.item-card .file-button {
  color: #f4f8f2;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow: none;
}

.item-card .tiny-button {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  min-height: 2rem;
  display: inline-grid;
  place-items: center;
  padding: 0;
}

.item-card-tools .tiny-button {
  position: relative;
}

.edit-toggle-button::before {
  content: none;
}

.delete-button::before {
  content: none;
}

.edit-toggle-button .close-icon {
  display: none;
}

.edit-toggle-button.is-open .edit-icon {
  display: none;
}

.edit-toggle-button.is-open .close-icon {
  display: block;
}

.item-card .ghost-button:hover,
.item-card .icon-button:hover,
.item-card .danger-button:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.34);
}

.item-card .primary-button {
  color: #2a4032;
  background: #f7faf5;
  box-shadow: none;
}

.item-card .item-section-header h4,
.item-card .adjust-panel-title,
.item-card label,
.item-card .comment-author,
.item-card .comment-text,
.item-card .comment-timestamp {
  color: #f4f8f2;
}

.item-card .empty-state {
  color: rgba(244, 248, 242, 0.82);
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.location-move-button {
  min-width: 4.5rem;
}

.adjust-panel-title {
  margin: 0 0 0.5rem;
  font-weight: 700;
  font-size: 0.88rem;
}

.quantity-adjust-row {
  display: grid;
  gap: 0.55rem;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
}

.quantity-adjust-input,
.move-location-input,
.add-location-name,
.add-location-quantity {
  min-width: 7rem;
}

.location-form-grid,
.comment-form-grid,
.inline-edit-grid {
  display: grid;
  gap: 0.65rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.comment-list {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 0.7rem;
}

.comment-form {
  margin-top: 0.7rem;
  padding-top: 0.7rem;
  border-top: 1px solid rgba(255, 255, 255, 0.18);
}

.comment-row {
  padding: 0.65rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(63, 78, 54, 0.1);
  background: rgba(255, 255, 255, 0.82);
}

.item-card .comment-row .comment-author {
  color: #22302a;
}

.item-card .comment-row .comment-text {
  color: #33433a;
}

.item-card .comment-row .comment-timestamp {
  color: rgba(51, 67, 58, 0.68);
}

.comment-row-header {
  display: flex;
  justify-content: space-between;
  gap: 0.55rem;
  align-items: baseline;
  margin-bottom: 0.25rem;
}

.comment-author,
.comment-timestamp,
.comment-text {
  margin: 0;
}

.comment-author {
  font-weight: 700;
}

.comment-timestamp {
  color: var(--muted);
  font-size: 0.74rem;
}

.comment-text {
  color: var(--text);
  line-height: 1.3;
  font-size: 0.84rem;
  white-space: pre-wrap;
}

.comment-text-label,
.inline-edit-notes-label {
  grid-column: 1 / -1;
}

.empty-state,
.empty-departments p:last-child {
  padding: 0.75rem;
  border-radius: var(--radius-md);
  border: 1px dashed rgba(63, 78, 54, 0.22);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
  font-size: 0.84rem;
}

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

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(34, 48, 58, 0.42);
  backdrop-filter: blur(8px);
}

.modal-panel {
  width: min(440px, 100%);
  padding: 1rem;
  border-radius: 22px;
  border: 1px solid rgba(97, 83, 57, 0.12);
  background: rgba(255, 252, 246, 0.98);
  box-shadow: var(--shadow-strong);
}

.scanner-modal {
  width: min(540px, 100%);
}

.scanner-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 0.8rem;
}

.scanner-frame {
  overflow: hidden;
  border-radius: 18px;
  border: 1px solid rgba(97, 83, 57, 0.14);
  background: #111827;
  aspect-ratio: 16 / 10;
}

.scanner-frame video {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.barcode-manual-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
  align-items: end;
}

.barcode-manual-form input {
  font-family: var(--font-mono);
  font-weight: 800;
  letter-spacing: 0.04em;
}

.modal-close-button {
  position: absolute;
  top: 0.85rem;
  right: 0.85rem;
  width: 2.2rem;
  height: 2.2rem;
  display: inline-grid;
  place-items: center;
  border: 1px solid rgba(97, 83, 57, 0.12);
  border-radius: 12px;
  color: var(--accent-strong);
  background: rgba(255, 255, 255, 0.78);
}

.department-modal {
  position: relative;
  width: min(448px, 100%);
  padding: 1.15rem;
}

.department-modal h2 {
  margin-bottom: 0.9rem;
}

.modal-form {
  display: grid;
  gap: 0.75rem;
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 0.25rem;
}

.modal-panel h2 {
  margin-bottom: 0.55rem;
}

.modal-panel p {
  color: var(--muted);
  line-height: 1.4;
}

.danger-modal {
  border-color: rgba(161, 75, 64, 0.24);
}

.danger-modal .form-actions {
  margin-top: 1rem;
}

.guide-shell {
  width: min(840px, calc(100% - 1.25rem));
  margin: 0 auto;
  padding: 1rem 0 1.75rem;
}

.guide-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 1rem;
  padding: 1rem 1.1rem;
}

.guide-title {
  margin-bottom: 0.3rem;
}

.guide-copy {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.35;
}

.guide-grid {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
}

.guide-overview {
  margin-top: 0.75rem;
  padding: 1rem;
}

.guide-card {
  padding: 0.9rem;
}

.guide-card p:last-child,
.guide-list {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.guide-list {
  padding-left: 1rem;
}

.guide-list li,
.guide-steps li {
  margin-bottom: 0.45rem;
}

.guide-list li:last-child,
.guide-steps li:last-child {
  margin-bottom: 0;
}

.guide-steps {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.4;
}

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

@media (max-width: 920px) {
  .auth-shell {
    grid-template-columns: 1fr;
    align-items: center;
  }

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

  .department-form,
  .member-email-row,
  .barcode-manual-form,
  .form-row,
  .guide-grid,
  .summary-grid,
  .stats-grid,
  .department-grid,
  .management-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .page-shell {
    width: min(100% - 1rem, 100%);
    padding-top: 0.8rem;
  }

  .auth-shell {
    width: 100%;
    padding: 0.35rem;
  }

  .hero,
  .modal-panel,
  .department-panel,
  .form-panel,
  .department-card,
  .empty-departments,
  .stat-card,
  .guide-card,
  .guide-overview,
  .guide-header,
  .management-panel,
  .management-header,
  .summary-card,
  .locked-panel {
    padding: 1rem;
  }

  .account-panel {
    padding-right: 3.7rem;
  }

  .department-chip,
  .item-card-header,
  .department-card-header,
  .quick-action-header,
  .dropdown-panel-header,
  .management-header,
  .comment-row-header,
  .page-header-panel {
    flex-direction: column;
    align-items: start;
  }

  .department-header-actions,
  .hero-actions {
    width: 100%;
    justify-content: flex-start;
  }

  .item-card-tools,
  .location-row-main,
  .quantity-adjust-row,
  .location-form-grid,
  .comment-form-grid,
  .inline-edit-grid {
    width: 100%;
    grid-template-columns: 1fr;
    justify-content: start;
  }

  .item-section-header,
  .location-row-actions {
    flex-direction: column;
    align-items: start;
  }

}

/* ─── Install banner ─────────────────────────────────────── */

.install-banner {
  position: fixed;
  left: 50%;
  bottom: max(1rem, env(safe-area-inset-bottom, 1rem));
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.8rem;
  width: min(440px, calc(100% - 1.5rem));
  padding: 0.8rem 0.9rem 0.8rem 1.05rem;
  border-radius: 18px;
  border: 1px solid rgba(97, 83, 57, 0.14);
  background: rgba(255, 252, 246, 0.97);
  box-shadow: var(--shadow-strong);
  backdrop-filter: blur(10px);
  animation: install-banner-in 280ms ease both;
}

@keyframes install-banner-in {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(0.6rem);
  }
  to {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

.install-banner-copy {
  flex: 1;
  margin: 0;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 600;
  line-height: 1.4;
}

.install-banner-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex: 0 0 auto;
}

.install-banner-button {
  border: 0;
  border-radius: 999px;
  padding: 0.5rem 0.95rem;
  color: #f7f7f1;
  background: linear-gradient(135deg, #516c58, var(--accent-strong));
  font-size: 0.82rem;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(42, 64, 50, 0.2);
  transition: transform 160ms ease;
}

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

.install-banner-dismiss {
  width: 1.8rem;
  height: 1.8rem;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 1.2rem;
  line-height: 1;
  opacity: 0.75;
}

.install-banner-dismiss:hover {
  opacity: 1;
  background: rgba(39, 49, 38, 0.08);
}

/* ─── Theme toggle button icons ──────────────────────────── */

.theme-icon-dark {
  display: none;
}

[data-theme="dark"] .theme-icon-light,
[data-theme="system-dark"] .theme-icon-light {
  display: none;
}

[data-theme="dark"] .theme-icon-dark,
[data-theme="system-dark"] .theme-icon-dark {
  display: block;
}

/* ─── Low-stock banner ───────────────────────────────────── */

.low-stock-banner {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(172, 107, 48, 0.24);
  background: rgba(172, 107, 48, 0.1);
  color: var(--warning);
  font-size: 0.88rem;
  font-weight: 600;
  flex-wrap: wrap;
}

.low-stock-icon {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
}

#low-stock-message {
  flex: 1;
}

.low-stock-action {
  border: 1px solid rgba(172, 107, 48, 0.3);
  border-radius: 999px;
  padding: 0.28rem 0.72rem;
  background: rgba(255, 255, 255, 0.6);
  color: var(--warning);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 140ms ease;
}

.low-stock-action:hover {
  background: rgba(255, 255, 255, 0.85);
}

.low-stock-dismiss {
  width: 1.5rem;
  height: 1.5rem;
  display: inline-grid;
  place-items: center;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--warning);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  opacity: 0.7;
  flex: 0 0 auto;
}

.low-stock-dismiss:hover {
  opacity: 1;
}

/* ─── Conflict banner ────────────────────────────────────── */

.conflict-banner {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(161, 75, 64, 0.22);
  background: rgba(161, 75, 64, 0.09);
  color: var(--danger);
  font-size: 0.88rem;
  flex-wrap: wrap;
}

.conflict-review-button {
  margin-left: auto;
  border: 1px solid rgba(161, 75, 64, 0.3);
  border-radius: 999px;
  padding: 0.28rem 0.72rem;
  background: rgba(255, 255, 255, 0.6);
  color: var(--danger);
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
  transition: background 140ms ease;
}

.conflict-review-button:hover {
  background: rgba(255, 255, 255, 0.85);
}

/* ─── Conflict modal ─────────────────────────────────────── */

.conflict-modal {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(34, 48, 58, 0.5);
  backdrop-filter: blur(10px);
}

.conflict-modal-inner {
  width: min(680px, 100%);
  max-height: 88vh;
  overflow-y: auto;
  padding: 1.25rem;
  border-radius: 22px;
  border: 1px solid rgba(97, 83, 57, 0.12);
  background: rgba(255, 252, 246, 0.98);
  box-shadow: var(--shadow-strong);
}

.conflict-modal-desc {
  color: var(--muted);
  font-size: 0.9rem;
  margin-bottom: 1rem;
}

.conflict-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  display: grid;
  gap: 0.85rem;
}

.conflict-item {
  padding: 0.85rem;
  border-radius: var(--radius-md);
  border: 1px solid rgba(97, 83, 57, 0.1);
  background: rgba(255, 255, 255, 0.72);
}

.conflict-item-header {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
  margin-bottom: 0.65rem;
  flex-wrap: wrap;
}

.conflict-product-name {
  font-family: var(--font-heading);
  font-size: 1rem;
}

.conflict-changed-fields {
  font-size: 0.78rem;
  color: var(--muted);
}

.conflict-versions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.6rem;
}

.conflict-version {
  padding: 0.65rem;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(97, 83, 57, 0.1);
  background: rgba(240, 235, 226, 0.5);
}

.conflict-version-label {
  margin: 0 0 0.18rem;
  font-weight: 700;
  font-size: 0.82rem;
}

.conflict-version-meta {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.conflict-state {
  margin: 0 0 0.6rem;
  padding: 0.5rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.7);
  font-size: 0.74rem;
  line-height: 1.45;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--text);
}

.conflict-close-button {
  border: 1px solid rgba(97, 83, 57, 0.14);
  border-radius: 999px;
  padding: 0.5rem 1.2rem;
  background: rgba(255, 255, 255, 0.8);
  color: var(--accent-strong);
  font-weight: 700;
  cursor: pointer;
  font-size: 0.88rem;
}

/* ─── Dark mode ──────────────────────────────────────────── */

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #141a16;
    --bg-accent: #1c2420;
    --surface: rgba(22, 30, 24, 0.96);
    --surface-strong: #1e2a22;
    --surface-soft: rgba(18, 26, 20, 0.9);
    --border: rgba(130, 160, 135, 0.13);
    --text: #dce8de;
    --muted: #7f9e88;
    --accent: #78b086;
    --accent-strong: #98cc9e;
    --warm: #d48055;
    --warning: #c4895a;
    --danger: #d0706a;
    --shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
    --shadow-strong: 0 24px 60px rgba(0, 0, 0, 0.42);
  }
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #141a16;
  --bg-accent: #1c2420;
  --surface: rgba(22, 30, 24, 0.96);
  --surface-strong: #1e2a22;
  --surface-soft: rgba(18, 26, 20, 0.9);
  --border: rgba(130, 160, 135, 0.13);
  --text: #dce8de;
  --muted: #7f9e88;
  --accent: #78b086;
  --accent-strong: #98cc9e;
  --warm: #d48055;
  --warning: #c4895a;
  --danger: #d0706a;
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.32);
  --shadow-strong: 0 24px 60px rgba(0, 0, 0, 0.42);
}

@media (prefers-color-scheme: dark) {
  body:not([data-theme="light"] body) {
    background:
      radial-gradient(circle at top left, rgba(50, 80, 55, 0.18), transparent 30%),
      linear-gradient(180deg, #13191a 0%, #0e1410 100%);
  }
}

:root[data-theme="dark"] body,
:root[data-theme="dark"] {
  background:
    radial-gradient(circle at top left, rgba(50, 80, 55, 0.18), transparent 30%),
    linear-gradient(180deg, #13191a 0%, #0e1410 100%);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .auth-shell {
    background:
      radial-gradient(ellipse 80% 50% at 50% -10%, rgba(65, 91, 73, 0.14) 0%, transparent 60%),
      linear-gradient(180deg, #141a16 0%, #0f1510 100%);
  }

  :root:not([data-theme="light"]) .hero,
  :root:not([data-theme="light"]) .panel {
    background: linear-gradient(180deg, rgba(24, 34, 26, 0.97), rgba(20, 28, 22, 0.99));
    border-color: rgba(130, 160, 135, 0.13);
  }

  :root:not([data-theme="light"]) input,
  :root:not([data-theme="light"]) select,
  :root:not([data-theme="light"]) textarea {
    background: rgba(22, 32, 24, 0.88);
    border-color: rgba(100, 140, 110, 0.18);
    color: #dce8de;
  }

  :root:not([data-theme="light"]) .auth-card {
    background: #1a2420;
    border-color: rgba(100, 140, 110, 0.14);
  }

  :root:not([data-theme="light"]) .auth-card input {
    background: #1e2e28;
    border-color: #2e4035;
    color: #dce8de;
  }

  :root:not([data-theme="light"]) .auth-card h2 { color: #dce8de; }
  :root:not([data-theme="light"]) .auth-card .subtext { color: #7f9e88; }

  :root:not([data-theme="light"]) .item-card {
    background: linear-gradient(180deg, #25382b 0%, #1d2e22 100%);
    border-color: rgba(110, 160, 120, 0.3);
  }

  :root:not([data-theme="light"]) .modal-panel {
    background: rgba(18, 26, 20, 0.98);
  }

  :root:not([data-theme="light"]) .department-chip {
    background: rgba(22, 32, 24, 0.72);
  }

  :root:not([data-theme="light"]) .sort-menu-panel {
    background: rgba(22, 32, 24, 0.98);
  }

  :root:not([data-theme="light"]) .stack-card,
  :root:not([data-theme="light"]) .checkbox-item,
  :root:not([data-theme="light"]) .invite-preview {
    background: rgba(26, 38, 28, 0.84);
  }

  :root:not([data-theme="light"]) .comment-row {
    background: rgba(255, 255, 255, 0.05);
  }

  :root:not([data-theme="light"]) .item-card .comment-row .comment-author { color: #dce8de; }
  :root:not([data-theme="light"]) .item-card .comment-row .comment-text { color: #c0d4c6; }
  :root:not([data-theme="light"]) .item-card .comment-row .comment-timestamp { color: rgba(192, 212, 198, 0.6); }

  :root:not([data-theme="light"]) .room-search input {
    background: #2b4534;
    border-color: rgba(110, 160, 120, 0.4);
    color: #eef6ef;
  }

  :root:not([data-theme="light"]) .room-search input::placeholder {
    color: rgba(238, 246, 239, 0.5);
  }

  :root:not([data-theme="light"]) .conflict-modal-inner {
    background: rgba(18, 26, 20, 0.98);
  }

  :root:not([data-theme="light"]) .conflict-item {
    background: rgba(24, 34, 26, 0.82);
  }

  :root:not([data-theme="light"]) .conflict-version {
    background: rgba(20, 28, 22, 0.7);
  }
}

:root[data-theme="dark"] .auth-shell {
  background:
    radial-gradient(ellipse 80% 50% at 50% -10%, rgba(65, 91, 73, 0.14) 0%, transparent 60%),
    linear-gradient(180deg, #141a16 0%, #0f1510 100%);
}

:root[data-theme="dark"] .hero,
:root[data-theme="dark"] .panel {
  background: linear-gradient(180deg, rgba(24, 34, 26, 0.97), rgba(20, 28, 22, 0.99));
  border-color: rgba(130, 160, 135, 0.13);
}

:root[data-theme="dark"] input,
:root[data-theme="dark"] select,
:root[data-theme="dark"] textarea {
  background: rgba(22, 32, 24, 0.88);
  border-color: rgba(100, 140, 110, 0.18);
  color: #dce8de;
}

:root[data-theme="dark"] .auth-card {
  background: #1a2420;
  border-color: rgba(100, 140, 110, 0.14);
}

:root[data-theme="dark"] .auth-card input {
  background: #1e2e28;
  border-color: #2e4035;
  color: #dce8de;
}

:root[data-theme="dark"] .auth-card h2 { color: #dce8de; }
:root[data-theme="dark"] .auth-card .subtext { color: #7f9e88; }

:root[data-theme="dark"] .item-card {
  background: linear-gradient(180deg, #25382b 0%, #1d2e22 100%);
  border-color: rgba(110, 160, 120, 0.3);
}

:root[data-theme="dark"] .modal-panel {
  background: rgba(18, 26, 20, 0.98);
}

:root[data-theme="dark"] .department-chip {
  background: rgba(22, 32, 24, 0.72);
}

:root[data-theme="dark"] .sort-menu-panel {
  background: rgba(22, 32, 24, 0.98);
}

:root[data-theme="dark"] .stack-card,
:root[data-theme="dark"] .checkbox-item,
:root[data-theme="dark"] .invite-preview {
  background: rgba(26, 38, 28, 0.84);
}

:root[data-theme="dark"] .room-search input {
  background: #2b4534;
  border-color: rgba(110, 160, 120, 0.4);
  color: #eef6ef;
}

:root[data-theme="dark"] .conflict-modal-inner {
  background: rgba(18, 26, 20, 0.98);
}

/* ─── Polish: smooth scrolling + selection ───────────────── */

html {
  scroll-behavior: smooth;
}

::selection {
  background: rgba(65, 91, 73, 0.2);
  color: var(--text);
}

:root[data-theme="dark"] ::selection {
  background: rgba(120, 176, 134, 0.28);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) ::selection {
    background: rgba(120, 176, 134, 0.28);
  }
}

/* ─── Dark mode: buttons, auth extras, install banner ────── */

:root[data-theme="dark"] .primary-button,
:root[data-theme="dark"] .auth-card .primary-button,
:root[data-theme="dark"] .install-banner-button,
:root[data-theme="dark"] .company-mode-button.is-active,
:root[data-theme="dark"] .room-add-button {
  color: #eef6ef;
  background: linear-gradient(135deg, #3f5d47, #2c4434);
  border-color: transparent;
  box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
}

:root[data-theme="dark"] .auth-card .social-button,
:root[data-theme="dark"] .password-toggle,
:root[data-theme="dark"] .company-mode-button,
:root[data-theme="dark"] .auth-card .helper {
  background: #1e2e28;
  border-color: #2e4035;
  color: #a8bfae;
}

:root[data-theme="dark"] .apple-button,
:root[data-theme="dark"] .apple-icon {
  color: #dce8de;
}

:root[data-theme="dark"] .install-banner {
  background: rgba(24, 34, 26, 0.97);
  border-color: rgba(130, 160, 135, 0.18);
}

:root[data-theme="dark"] .install-banner-dismiss:hover {
  background: rgba(220, 232, 222, 0.1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .primary-button,
  :root:not([data-theme="light"]) .auth-card .primary-button,
  :root:not([data-theme="light"]) .install-banner-button,
  :root:not([data-theme="light"]) .company-mode-button.is-active,
  :root:not([data-theme="light"]) .room-add-button {
    color: #eef6ef;
    background: linear-gradient(135deg, #3f5d47, #2c4434);
    border-color: transparent;
    box-shadow: 0 10px 22px rgba(0, 0, 0, 0.3);
  }

  :root:not([data-theme="light"]) .company-mode-button.is-active {
    color: #eef6ef;
  }

  :root:not([data-theme="light"]) .auth-card .social-button,
  :root:not([data-theme="light"]) .password-toggle,
  :root:not([data-theme="light"]) .company-mode-button,
  :root:not([data-theme="light"]) .auth-card .helper {
    background: #1e2e28;
    border-color: #2e4035;
    color: #a8bfae;
  }

  :root:not([data-theme="light"]) .auth-card .social-button {
    background: #1e2e28;
  }

  :root:not([data-theme="light"]) .apple-button,
  :root:not([data-theme="light"]) .apple-icon {
    color: #dce8de;
  }

  :root:not([data-theme="light"]) .install-banner {
    background: rgba(24, 34, 26, 0.97);
    border-color: rgba(130, 160, 135, 0.18);
  }

  :root:not([data-theme="light"]) .install-banner-dismiss:hover {
    background: rgba(220, 232, 222, 0.1);
  }

  :root:not([data-theme="light"]) .ghost-button,
  :root:not([data-theme="light"]) .file-button,
  :root:not([data-theme="light"]) .icon-button {
    color: var(--accent-strong);
    background: rgba(34, 46, 36, 0.85);
    border-color: rgba(130, 160, 135, 0.16);
  }

  :root:not([data-theme="light"]) .room-filter-button {
    background: rgba(34, 46, 36, 0.85);
  }

  :root:not([data-theme="light"]) .disclosure-icon,
  :root:not([data-theme="light"]) .modal-close-button {
    background: rgba(34, 46, 36, 0.85);
    border-color: rgba(130, 160, 135, 0.16);
  }

  :root:not([data-theme="light"]) .empty-state,
  :root:not([data-theme="light"]) .empty-departments p:last-child {
    background: rgba(28, 40, 30, 0.6);
    border-color: rgba(130, 160, 135, 0.24);
  }

  :root:not([data-theme="light"]) .meta-item {
    background: rgba(34, 46, 36, 0.7);
  }
}

:root[data-theme="dark"] .ghost-button,
:root[data-theme="dark"] .file-button,
:root[data-theme="dark"] .icon-button {
  color: var(--accent-strong);
  background: rgba(34, 46, 36, 0.85);
  border-color: rgba(130, 160, 135, 0.16);
}

:root[data-theme="dark"] .room-filter-button {
  background: rgba(34, 46, 36, 0.85);
}

:root[data-theme="dark"] .disclosure-icon,
:root[data-theme="dark"] .modal-close-button {
  background: rgba(34, 46, 36, 0.85);
  border-color: rgba(130, 160, 135, 0.16);
}

:root[data-theme="dark"] .empty-state,
:root[data-theme="dark"] .empty-departments p:last-child {
  background: rgba(28, 40, 30, 0.6);
  border-color: rgba(130, 160, 135, 0.24);
}

:root[data-theme="dark"] .meta-item {
  background: rgba(34, 46, 36, 0.7);
}
