:root,
[data-theme="dark"] {
  --bg: #1c1d20;
  --bg-deep: #16171a;
  --panel: rgba(40, 41, 46, 0.92);
  --panel-solid: #2a2b30;
  --elevated: rgba(255, 255, 255, 0.06);
  --elevated-strong: rgba(255, 255, 255, 0.1);
  --ink: #f2f1ef;
  --ink-soft: #d8d6d2;
  --ink-inverse: #141416;
  --muted: #9c9a96;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
  --shadow-sm: 0 6px 18px rgba(0, 0, 0, 0.2);
  --topbar-bg: rgba(28, 29, 32, 0.88);
  --tabs-bg: transparent;
  --sidebar-bg: #18191c;
  --input-bg: rgba(24, 25, 28, 0.75);
  --table-wrap-bg: rgba(24, 25, 28, 0.45);
  --table-sticky: #2a2b30;
  --table-head: #232428;
  --modal-scrim: rgba(12, 12, 14, 0.55);
  --pre-bg: rgba(255, 255, 255, 0.05);
  --focus-ring: rgba(255, 255, 255, 0.12);
  --glow-1: rgba(255, 255, 255, 0.06);
  --glow-2: rgba(120, 118, 112, 0.18);
  --glow-3: rgba(50, 50, 54, 0.4);
  --login-blob: linear-gradient(145deg, #3a3b40, #1c1d20);
  --scroll-track: rgba(255, 255, 255, 0.05);
  --scroll-thumb: rgba(255, 255, 255, 0.2);
  --scroll-thumb-hover: rgba(255, 255, 255, 0.34);
  --code-bg: #16171a;
  --code-fg: #f2eee8;
  --radius: 22px;
  --radius-sm: 14px;
  --radius-xs: 10px;
  --accent: #f2f1ef;
  --accent-hover: #ffffff;
  --accent-soft: rgba(255, 255, 255, 0.1);
  --accent-muted: rgba(255, 255, 255, 0.16);
  --warn: #c4b851;
  --warn-bg: rgba(196, 184, 81, 0.14);
  --purple: #a78bfa;
  --purple-bg: rgba(167, 139, 250, 0.14);
  --danger: #ef6a5a;
  --danger-bg: rgba(239, 106, 90, 0.14);
  --ok: #4ecf8a;
  --ok-bg: rgba(78, 207, 138, 0.12);
  --font: "Nunito", "Segoe UI", sans-serif;
  --display: "Nunito", "Segoe UI", sans-serif;
  --sidebar-w: 232px;
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #ece8e3;
  --bg-deep: #e2ddd6;
  --panel: rgba(255, 252, 248, 0.88);
  --panel-solid: #fffcf8;
  --elevated: rgba(10, 10, 10, 0.05);
  --elevated-strong: rgba(10, 10, 10, 0.08);
  --ink: #0a0a0a;
  --ink-soft: #1c1c1c;
  --ink-inverse: #ffffff;
  --muted: #6b6560;
  --line: rgba(10, 10, 10, 0.1);
  --line-strong: rgba(10, 10, 10, 0.18);
  --shadow: 0 18px 40px rgba(20, 16, 12, 0.08);
  --shadow-sm: 0 6px 18px rgba(20, 16, 12, 0.06);
  --topbar-bg: rgba(255, 252, 248, 0.72);
  --tabs-bg: transparent;
  --sidebar-bg: #f3efe9;
  --input-bg: rgba(255, 255, 255, 0.72);
  --table-wrap-bg: rgba(255, 255, 255, 0.45);
  --table-sticky: #fffcf8;
  --table-head: #f3efe9;
  --modal-scrim: rgba(30, 26, 22, 0.45);
  --pre-bg: rgba(10, 10, 10, 0.04);
  --focus-ring: rgba(10, 10, 10, 0.08);
  --glow-1: rgba(255, 255, 255, 0.7);
  --glow-2: rgba(210, 200, 188, 0.45);
  --glow-3: rgba(190, 180, 168, 0.3);
  --login-blob: linear-gradient(145deg, #f5f2ed, #d9d2c8);
  --scroll-track: rgba(10, 10, 10, 0.06);
  --scroll-thumb: rgba(10, 10, 10, 0.22);
  --scroll-thumb-hover: rgba(10, 10, 10, 0.36);
  --code-bg: #1a1816;
  --code-fg: #f2eee8;
  --accent: #0a0a0a;
  --accent-hover: #2a2a2a;
  --accent-soft: rgba(10, 10, 10, 0.08);
  --accent-muted: rgba(10, 10, 10, 0.12);
  --warn: #9a7b12;
  --warn-bg: rgba(154, 123, 18, 0.1);
  --purple: #6d5bb8;
  --purple-bg: rgba(109, 91, 184, 0.1);
  --danger: #c43c2c;
  --danger-bg: rgba(196, 60, 44, 0.1);
  --ok: #1f7a4c;
  --ok-bg: rgba(31, 122, 76, 0.1);
  color-scheme: light;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--bg);
  background-image:
    radial-gradient(ellipse 90% 60% at 12% -8%, var(--glow-1) 0%, transparent 55%),
    radial-gradient(ellipse 70% 50% at 100% 0%, var(--glow-2) 0%, transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 100%, var(--glow-3) 0%, transparent 55%);
  background-attachment: fixed;
  transition: background-color 0.25s ease, color 0.25s ease;
}

a {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  border-bottom: 1.5px solid transparent;
  transition: border-color 0.2s ease, opacity 0.2s ease;
}

a:hover { border-bottom-color: var(--ink); }

.app-shell {
  display: flex;
  min-height: 100vh;
  align-items: stretch;
}

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 18px 14px;
  background: var(--sidebar-bg);
  border-right: 1px solid var(--line);
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 20;
  animation: barIn 0.4s ease both;
}

.sidebar-brand {
  padding: 4px 8px 8px;
}

.brand-mark-dot {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  background: linear-gradient(145deg, #f2f1ef, #9c9a96);
  box-shadow: 0 0 0 3px var(--accent-soft), var(--shadow-sm);
  flex-shrink: 0;
}

[data-theme="light"] .brand-mark-dot {
  background: linear-gradient(145deg, #1c1c1c, #6b6560);
}

.sidebar-group {
  flex: 1 1 auto;
  min-height: 0;
  overflow: auto;
}

.sidebar-label {
  padding: 0 12px 8px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.sidebar-footer {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.sidebar-logout {
  width: 40px;
  flex: 0 0 40px;
}

.app-main {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  backdrop-filter: blur(14px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.topbar-title {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.15;
}

.topbar-kicker {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-title strong {
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--display);
  font-weight: 900;
  letter-spacing: -0.04em;
  color: var(--ink);
  font-size: 1.15rem;
  border-bottom: 0;
}

.brand:hover { border-bottom: 0; opacity: 0.85; }

.brand-mark {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  object-fit: cover;
  box-shadow: var(--shadow-sm);
  flex-shrink: 0;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-text strong {
  font-size: 1.05rem;
  font-weight: 900;
  letter-spacing: -0.04em;
}

.brand-text span {
  font-size: 0.68rem;
  font-weight: 700;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.theme-toggle {
  appearance: none;
  border: 1.5px solid var(--line-strong);
  background: var(--elevated);
  color: var(--ink);
  width: 40px;
  height: 40px;
  border-radius: 999px;
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  padding: 0;
  transition: transform 0.15s ease, background 0.2s ease, border-color 0.2s ease;
}

.theme-toggle:hover {
  transform: translateY(-1px);
  background: var(--elevated-strong);
}

.theme-toggle svg {
  width: 18px;
  height: 18px;
}

.theme-toggle .icon-sun { display: block; }
.theme-toggle .icon-moon { display: none; }

[data-theme="light"] .theme-toggle .icon-sun { display: none; }
[data-theme="light"] .theme-toggle .icon-moon { display: block; }

.user-chip {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--elevated);
}

.wrap {
  width: min(1280px, calc(100% - 36px));
  margin: 18px auto 48px;
  animation: riseIn 0.5s ease both;
}

.panel-tabs {
  display: flex;
  flex-direction: column;
  gap: 4px;
  width: 100%;
  margin: 0;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  box-shadow: none;
}

.panel-tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-weight: 750;
  font-size: 0.9rem;
  line-height: 1;
  padding: 11px 12px;
  border-radius: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
  transition: background 0.18s ease, color 0.18s ease, box-shadow 0.18s ease;
}

.panel-tab svg,
.panel-tab .ico {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  opacity: 0.7;
  display: block;
}

.panel-tab.is-active svg,
.panel-tab.is-active .ico { opacity: 1; }

.ico {
  width: 1em;
  height: 1em;
  flex-shrink: 0;
  display: block;
  pointer-events: none;
}

.btn-ico,
.mbtn-ico,
.cell-btn-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-ico .ico {
  width: 15px;
  height: 15px;
}

.mbtn-ico {
  gap: 5px;
}

.mbtn-ico .ico {
  width: 12px;
  height: 12px;
  opacity: 0.95;
}

.mbtn-more.mbtn-ico {
  padding-left: 7px;
  padding-right: 7px;
  min-width: 28px;
}

.mbtn-more.mbtn-ico .ico {
  width: 14px;
  height: 14px;
}

.cell-btn-ico .ico {
  width: 13px;
  height: 13px;
}

.mafile-more-menu .mbtn-ico {
  justify-content: flex-start;
}

.panel-tab:hover {
  background: var(--elevated);
  color: var(--ink);
}

.panel-tab.is-active {
  background: var(--accent);
  color: var(--ink-inverse);
  box-shadow: none;
}

.tab-panel[hidden] { display: none !important; }

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--elevated);
  color: var(--ink-soft);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  white-space: nowrap;
}

.status-accepted {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: rgba(78, 207, 138, 0.28);
}

.status-sent {
  color: var(--purple);
  background: var(--purple-bg);
  border-color: rgba(167, 139, 250, 0.28);
}

.status-hold {
  color: var(--warn);
  background: var(--warn-bg);
  border-color: rgba(196, 184, 81, 0.28);
}

.status-other {
  color: var(--muted);
}

.loc-pill {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--elevated-strong);
  border: 1px solid var(--line-strong);
  color: var(--ink-soft);
  font-size: 0.76rem;
  font-weight: 800;
}

.muted-cell {
  color: var(--muted);
  font-size: 0.85rem;
  max-width: 280px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.login-page {
  background-image: none;
  background-color: var(--bg-deep);
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  position: relative;
}

.login-theme {
  position: absolute;
  top: 16px;
  right: 16px;
}

.login-card {
  width: min(360px, 100%);
  margin: 0;
  padding: 32px 28px 26px;
  text-align: center;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: none;
  backdrop-filter: none;
}

.login-logo {
  width: 56px;
  height: 56px;
  border-radius: 14px;
  object-fit: cover;
  margin: 0 auto 14px;
  display: block;
}

.login-card h1 {
  margin: 0 0 22px;
  font-size: 1.2rem;
  font-weight: 800;
  letter-spacing: -0.03em;
  line-height: 1.2;
}

.login-card form {
  text-align: left;
}

.login-card .field {
  margin-bottom: 12px;
}

.login-submit {
  width: 100%;
  margin-top: 8px;
}

.login-card .msg {
  margin-top: 12px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(10px);
}

.card h1,
.card h2 {
  margin: 0 0 6px;
  font-family: var(--display);
  font-size: 1.28rem;
  font-weight: 900;
  letter-spacing: -0.035em;
}

.sub {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 0.92rem;
  font-weight: 600;
}

label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 800;
  letter-spacing: 0.02em;
}

.field { margin-bottom: 14px; }

input[type="text"],
input[type="password"],
input[type="search"] {
  width: 100%;
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong);
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.row {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.row > .grow { flex: 1 1 220px; }

.btn {
  appearance: none;
  border: 1.5px solid transparent;
  border-radius: 999px;
  padding: 11px 18px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  background: var(--accent);
  color: var(--ink-inverse);
  transition: transform 0.15s ease, background 0.2s ease, box-shadow 0.2s ease;
}

.btn:hover {
  background: var(--accent-hover);
  transform: translateY(-1px);
  box-shadow: var(--shadow-sm);
}

.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-ghost {
  background: transparent;
  border-color: var(--line-strong);
  color: var(--ink);
}

.btn-ghost:hover {
  background: var(--elevated);
  box-shadow: none;
}

.btn-danger {
  background: transparent;
  border-color: rgba(196, 60, 44, 0.45);
  color: var(--danger);
}

.btn-danger:hover { background: var(--danger-bg); box-shadow: none; }

.btn-sm {
  padding: 7px 12px;
  font-size: 0.84rem;
}

.msg {
  display: none;
  margin-top: 12px;
  padding: 11px 13px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 700;
}

.msg.show { display: block; }
.msg.err { background: var(--danger-bg); color: var(--danger); }
.msg.ok { background: var(--ok-bg); color: var(--ok); }

.logs-hero {
  align-items: flex-end;
  margin-bottom: 14px;
}

.logs-kicker {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.logs-title {
  margin: 0 !important;
  font-size: 2rem !important;
  font-weight: 900 !important;
  letter-spacing: -0.06em !important;
  line-height: 1 !important;
  background: linear-gradient(105deg, #fff 10%, #cfcbc4 55%, #8f8b84 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

[data-theme="light"] .logs-title {
  background: linear-gradient(105deg, #0a0a0a 10%, #3a3732 70%, #6b6560 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.logs-sub {
  margin-top: 8px !important;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.admin-stats {
  grid-template-columns: repeat(3, 1fr);
}

.admin-top-actions {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.admin-top-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--elevated);
  font-size: 0.9rem;
}

.admin-top-row strong {
  font-variant-numeric: tabular-nums;
}

.worker-cell {
  font-weight: 800;
}

.stat {
  --stat-tone: var(--muted);
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-height: 96px;
  background:
    linear-gradient(135deg, color-mix(in srgb, var(--stat-tone) 10%, transparent), transparent 42%),
    var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 12px 14px 12px 16px;
  box-shadow: inset 3px 0 0 var(--stat-tone);
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}

.stat::after {
  content: "";
  position: absolute;
  right: -18px;
  top: -24px;
  width: 92px;
  height: 92px;
  border-radius: 50%;
  opacity: 0.16;
  background: radial-gradient(circle, var(--stat-tone), transparent 68%);
  pointer-events: none;
}

.stat:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--stat-tone) 35%, var(--line));
}

.stat-accent-a { --stat-tone: #4ecf8a; }
.stat-accent-b { --stat-tone: #a78bfa; }
.stat-accent-c { --stat-tone: #9c9a96; }

.stat-top {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
}

.stat-ico {
  width: 28px;
  height: 28px;
  border-radius: 9px;
  display: inline-grid;
  place-items: center;
  color: var(--stat-tone);
  background: color-mix(in srgb, var(--stat-tone) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--stat-tone) 28%, transparent);
  flex-shrink: 0;
}

.stat-ico svg {
  width: 14px;
  height: 14px;
  display: block;
}

.stat .k {
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  margin: 0;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.stat-main {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-top: auto;
}

.stat .v {
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

.stat-hint {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  text-transform: lowercase;
}

.table-wrap { overflow-x: auto; }

* {
  scrollbar-width: thin;
  scrollbar-color: var(--scroll-thumb) var(--scroll-track);
}

*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

*::-webkit-scrollbar-track {
  background: var(--scroll-track);
  border-radius: 999px;
}

*::-webkit-scrollbar-thumb {
  background: var(--scroll-thumb);
  border-radius: 999px;
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-thumb:hover {
  background: var(--scroll-thumb-hover);
  border: 2px solid transparent;
  background-clip: padding-box;
}

*::-webkit-scrollbar-corner {
  background: transparent;
}

*::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th, td {
  text-align: left;
  padding: 11px 8px;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}

th {
  color: var(--muted);
  font-weight: 800;
  font-size: 0.76rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.modal-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: var(--modal-scrim);
  backdrop-filter: blur(6px);
  align-items: center;
  justify-content: center;
  padding: 16px;
  z-index: 40;
  animation: fadeIn 0.2s ease both;
}

.modal-backdrop.open { display: flex; }

.modal {
  width: min(560px, 100%);
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  max-height: min(80vh, 640px);
  overflow: auto;
  box-shadow: var(--shadow);
  animation: softPop 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.modal h3 {
  margin: 0 0 12px;
  font-family: var(--display);
  font-size: 1.15rem;
  font-weight: 900;
  letter-spacing: -0.03em;
}

.modal-confirm { width: min(420px, 100%); }

.confirm-message {
  margin: 0 0 18px;
  color: var(--ink-soft);
  line-height: 1.45;
  word-break: break-word;
  font-weight: 600;
}

.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.pre {
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--pre-bg);
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  padding: 10px;
  font-size: 0.82rem;
  color: var(--ink-soft);
  max-height: 180px;
  overflow: auto;
}

.kv { margin: 0 0 12px; }
.kv dt { color: var(--muted); font-size: 0.78rem; font-weight: 800; margin-bottom: 4px; }
.kv dd { margin: 0 0 10px; font-weight: 700; }

.empty {
  color: var(--muted);
  padding: 16px 0;
  text-align: center;
  font-weight: 700;
}

.mafile-card { padding-bottom: 10px; }

.mafile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.mafile-head-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.auto-refresh {
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mafile-toolbar {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

.mafile-toolbar input[type="search"] {
  flex: 1;
  min-width: 180px;
  width: auto;
}

.mafile-table-wrap {
  overflow-x: auto;
  overflow-y: auto;
  max-height: min(70vh, 820px);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--table-wrap-bg);
}

.mafile-table {
  width: 100%;
  min-width: 0;
  font-size: 0.82rem;
  table-layout: auto;
  border-collapse: collapse;
}

.mafile-table thead th,
.mafile-table tbody td {
  white-space: nowrap;
  vertical-align: middle !important;
  text-align: center;
  padding: 7px 8px;
  font-size: 0.76rem;
  border-bottom: 1px solid var(--line);
  line-height: 1.25;
  height: auto;
}

.mafile-table tbody tr:hover td {
  background: rgba(255, 255, 255, 0.025);
}

[data-theme="light"] .mafile-table tbody tr:hover td {
  background: rgba(10, 10, 10, 0.03);
}

.mafile-table thead th:first-child,
.mafile-table tbody td.sid-cell {
  text-align: left;
}

.mafile-table thead th:last-child,
.mafile-table tbody td:last-child {
  text-align: left;
  white-space: normal;
  position: static;
  background: transparent;
  z-index: auto;
  min-width: 0;
  width: auto;
  box-shadow: none;
}

.mafile-table tbody tr:last-child td {
  border-bottom: none;
}

.mafile-table th {
  position: sticky;
  top: 0;
  background: var(--table-head);
  z-index: 1;
  border-bottom: 1px solid var(--line);
  box-shadow: none;
}

.mafile-table th:last-child {
  z-index: 1;
  background: var(--table-head);
}

.worker-cell {
  font-weight: 800;
  white-space: nowrap;
  font-size: 0.78rem;
}

.sid-cell {
  white-space: normal !important;
  min-width: 130px;
  max-width: 180px;
  text-align: left !important;
}

.sid-cell.acc-cell {
  min-width: 210px;
  max-width: 260px;
}

.sid-cell .ava {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  vertical-align: middle;
  margin-right: 4px;
}

.sid-sub {
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 2px;
  font-weight: 600;
}

.acc-card {
  display: block;
  text-align: left;
  min-width: 200px;
}

.acc-top {
  display: flex;
  align-items: center;
  gap: 8px;
}

.acc-ava-wrap {
  position: relative;
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.acc-ava {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
  background: #2a2b30;
  border: 1px solid var(--line);
}

.acc-ava-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: #2a2b30;
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.62rem;
  font-weight: 900;
  letter-spacing: -0.02em;
}

.acc-ava-wrap .acc-ava-fallback {
  position: absolute;
  inset: 0;
}

.acc-ava-wrap.has-img .acc-ava-fallback {
  display: none;
}

.acc-ava-wrap.is-broken .acc-ava {
  display: none;
}

.acc-ava-wrap.is-broken .acc-ava-fallback {
  display: grid;
}

.acc-info {
  min-width: 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.acc-nick {
  display: block;
  font-weight: 800;
  font-size: 0.8rem;
  letter-spacing: -0.02em;
  color: var(--ink);
  border-bottom: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  line-height: 1.15;
}

.acc-nick:hover {
  border-bottom: 0;
  color: #fff;
}

.acc-meta {
  color: var(--muted);
  font-size: 0.64rem;
  font-weight: 650;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.acc-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  margin-top: 1px;
}

.acc-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 2px 6px;
  border-radius: 999px;
  font-size: 0.58rem;
  font-weight: 800;
  line-height: 1.15;
  border: 1px solid transparent;
  white-space: nowrap;
}

.acc-badge-sale {
  color: #e6c65c;
  background: rgba(230, 198, 92, 0.12);
  border-color: rgba(230, 198, 92, 0.28);
}

.acc-badge-limit {
  color: #f07a6c;
  background: rgba(239, 106, 90, 0.12);
  border-color: rgba(239, 106, 90, 0.3);
}

.acc-badge-guard {
  color: #c8c6c2;
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.12);
}

.acc-badge-pause {
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
}

.acc-badge-pro {
  color: #c4b5fd;
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.28);
}

.game-tags {
  display: flex;
  flex-wrap: nowrap;
  gap: 4px;
  justify-content: flex-start;
  align-items: center;
  min-width: 0;
  max-width: 220px;
  overflow: hidden;
}

.game-tag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #d8d6d2;
  font-size: 0.64rem;
  font-weight: 750;
  line-height: 1.2;
  white-space: nowrap;
}

.game-tag-more {
  color: var(--muted);
}

.game-tag-empty {
  color: var(--muted);
  background: transparent;
  border-color: transparent;
  grid-column: 1 / -1;
}

.inv-ok,
.inv-muted,
.hold-on,
.hold-off {
  display: inline;
  line-height: inherit;
  vertical-align: baseline;
}

.inv-ok { color: #22c55e; font-weight: 800; }
.inv-main {
  color: var(--ink);
  font-weight: 800;
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}
.inv-muted { color: var(--muted); margin-left: 4px; }
.inv-nt { color: #22c55e; font-weight: 800; }

.inv-price-cell {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  flex-wrap: wrap;
}

.inv-price-stack {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 6px;
  flex-wrap: nowrap;
}

.inv-price-btn {
  appearance: none;
  border: 0;
  background: none;
  padding: 0;
  margin: 0;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  line-height: inherit;
}

.inv-price-btn.inv-nt-pill {
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.28);
  color: #4ade80;
  font-size: 0.64rem;
  font-variant-numeric: tabular-nums;
}

.inv-price-btn:hover {
  opacity: 0.85;
}

.inv-price-btn.inv-nt-pill:hover {
  text-decoration: none;
  background: rgba(34, 197, 94, 0.18);
}

.modal-prices {
  width: min(420px, 100%);
  padding: 0;
  overflow: hidden;
}

.prices-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}

.prices-head h3 {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 800;
}

.prices-x {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}

.prices-x:hover { color: var(--ink); }

.prices-body {
  padding: 14px 16px 8px;
}

.prices-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0;
}

.prices-icon {
  width: 26px;
  height: 26px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
  background: #141414;
}

.prices-val {
  font-weight: 800;
  font-size: 0.95rem;
}

.prices-date {
  margin-top: 12px;
  color: var(--muted);
  font-size: 0.84rem;
}

.prices-empty {
  color: var(--muted);
  font-size: 0.86rem;
}

.prices-foot {
  display: flex;
  justify-content: flex-end;
  padding: 10px 16px 14px;
  border-top: 1px solid var(--line);
}
.hold-on { color: #c4b851; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 11px; }
.hold-off { color: #58b66e; font-variant-numeric: tabular-nums; font-weight: 800; font-size: 11px; }
.hold-timer { white-space: nowrap; }
.hold-clock { opacity: 0.9; }

[data-theme="light"] .hold-on { color: #9a7b12; }

.mindep-cell {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  vertical-align: middle;
}

.cell-center.mindep-cell {
  display: flex;
}

.mindep-input,
.note-input {
  width: 52px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid var(--line-strong);
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.7rem;
  font-weight: 650;
  height: 24px;
  line-height: 24px;
  box-sizing: border-box;
  margin: 0;
  vertical-align: middle;
}

.mindep-input { text-align: center; }

input.note-input {
  width: 72px;
  min-width: 0;
  max-width: 96px;
  text-align: left;
  padding: 0 6px;
  height: 24px;
  line-height: 24px;
  border-radius: 6px;
  box-shadow: none;
}

input.note-input:focus,
.mindep-input:focus {
  box-shadow: 0 0 0 3px var(--focus-ring);
  border-color: var(--ink);
  outline: none;
}

.cell-btn {
  appearance: none;
  border: 1px solid var(--line-strong);
  background: var(--elevated-strong);
  color: var(--ink);
  border-radius: 8px;
  padding: 0 9px;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 750;
  cursor: pointer;
  line-height: 24px;
  height: 24px;
  box-sizing: border-box;
  margin: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.cell-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
}

.drop {
  position: relative;
  flex: 0 0 auto;
}

.drop-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 156px;
  height: 44px;
  padding: 0 12px 0 14px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong);
  background: var(--input-bg);
  color: var(--ink);
  font: inherit;
  font-size: 0.86rem;
  font-weight: 700;
  cursor: pointer;
  box-sizing: border-box;
}

.drop-btn:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.drop-btn svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  opacity: 0.65;
}

.drop-menu {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  min-width: 100%;
  width: max-content;
  padding: 6px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  box-sizing: border-box;
}

.drop-menu[hidden] {
  display: none !important;
}

.drop-item {
  display: block;
  width: 100%;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 0.84rem;
  font-weight: 700;
  text-align: left;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.drop-item:hover {
  background: var(--elevated-strong);
}

.drop-item.is-active {
  background: var(--elevated-strong);
}

.deposit-table {
  width: 100% !important;
  min-width: 0 !important;
}

.deposit-table th:last-child,
.deposit-table td:last-child {
  position: static !important;
  box-shadow: none !important;
  min-width: 0 !important;
  width: auto !important;
  white-space: nowrap;
}

.deposit-table .items-cell {
  white-space: normal !important;
  min-width: 140px;
  max-width: 280px;
  font-size: 0.78rem;
}

.paid-no { color: var(--danger); font-weight: 800; }

.mafile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  align-items: center;
  justify-content: flex-start;
  min-width: 0;
  width: max-content;
  max-width: 100%;
  padding: 0;
}

.mafile-actions-compact {
  justify-content: center;
  width: 100%;
}

.mafile-actions-row {
  display: contents;
}

.mafile-more {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex-shrink: 0;
  vertical-align: middle;
}

.row-more-btn {
  appearance: none;
  width: 28px;
  height: 28px;
  padding: 0;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--elevated);
  color: var(--muted);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.row-more-btn svg {
  width: 14px;
  height: 14px;
  display: block;
}

.row-more-btn:hover,
.mafile-more.is-open .row-more-btn {
  color: var(--ink);
  background: var(--elevated-strong);
  border-color: rgba(255, 255, 255, 0.22);
}

.mafile-more-menu {
  position: fixed;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 188px;
  max-height: min(70vh, 420px);
  overflow: auto;
  width: max-content;
  padding: 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--panel-solid);
  box-shadow: var(--shadow);
  box-sizing: border-box;
  pointer-events: auto;
}

.mafile-more-menu[hidden] {
  display: none !important;
}

.mafile-more-menu .mbtn {
  display: flex;
  width: 100%;
  box-sizing: border-box;
  justify-content: flex-start;
  align-items: center;
  white-space: nowrap;
  height: auto;
  min-height: 28px;
  max-width: none !important;
  font-size: 0.72rem !important;
  line-height: 1.2 !important;
  padding: 4px 8px !important;
  text-align: left;
}

.mafile-more-menu .mbtn br {
  display: none;
}

.mafile-more-menu .mbtn-limit {
  white-space: nowrap !important;
  max-width: none !important;
}

.mbtn-more {
  background: #64748b;
  min-width: 36px;
  min-height: 28px;
  padding: 0 8px;
  font-size: 18px;
  font-weight: 900;
  line-height: 1;
  letter-spacing: 0;
}

.cell-center {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 36px;
  box-sizing: border-box;
}

.cell-center-left {
  justify-content: flex-start;
}

.mafile-table tbody td.sid-cell .cell-center {
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
  gap: 2px;
  min-height: 36px;
}

.mbtn {
  appearance: none;
  border: 0;
  border-radius: 3px;
  padding: 2px 6px;
  font: inherit;
  font-size: 0.68rem;
  font-weight: 700;
  line-height: 1.15;
  cursor: pointer;
  color: #fff;
  background: #4b5563;
  flex: 0 0 auto;
  white-space: nowrap;
  min-height: 0;
  transition: filter 0.12s ease;
}

.mbtn:hover { filter: brightness(1.12); }

.mbtn br { display: none; }

.mbtn-limit {
  white-space: normal;
  line-height: 1.05;
  max-width: 78px;
  text-align: center;
  padding: 2px 5px;
  font-size: 0.62rem;
}

.mbtn-limit br { display: inline; }

.mbtn-tickets {
  white-space: nowrap;
  line-height: 1.15;
  max-width: none;
}

.mbtn-purple { background: #9b4dff; }
.mbtn-blue { background: #3b82f6; }
.mbtn-teal { background: #14b8a6; }
.mbtn-yellow { background: #eab308; color: #1a1400; }
.mbtn-brown { background: #b45309; }
.mbtn-spam { background: #84cc16; color: #142006; }
.mbtn-limit { background: #22c55e; color: #052e16; }
.mbtn-tickets { background: #ef4444; }
.mbtn-tickets-on { background: #22c55e; color: #052e16; }
.mbtn-tickets-off { background: #ef4444; color: #fff; }
.mbtn-pause { background: #eab308; color: #1a1400; }
.mbtn-continue { background: #22c55e; color: #052e16; }
.mbtn-remove { background: #dc2626; }
.mbtn-solid { background: #4b5563; }

.modal-wide { width: min(720px, 100%); }

.modal-screen {
  width: min(560px, 100%);
  padding: 14px;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}

.screen-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
  padding: 0 2px;
}

.screen-toolbar-title {
  color: #fff;
  font-weight: 800;
  font-size: 0.9rem;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}

.screen-toolbar-actions {
  display: flex;
  gap: 8px;
}

.screen-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: #161618;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 10px 14px;
  color: #f2f1ef;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  font-family: "Nunito", "Segoe UI", sans-serif;
  white-space: nowrap;
}

.screen-logo {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  object-fit: cover;
  flex-shrink: 0;
}

.screen-brand {
  font-size: 0.95rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  flex-shrink: 0;
}

.screen-line {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  overflow-x: auto;
  font-size: 0.86rem;
  font-weight: 800;
}

.screen-sep {
  color: #6a655f;
  font-weight: 700;
}

.screen-worker {
  color: #9a948c;
  font-size: 0.78rem;
  font-weight: 700;
  margin-left: 4px;
}

.modal-wide.modal-inv {
  width: min(1180px, 97vw);
}

.modal-wide.modal-confirmations {
  width: min(760px, 96vw);
}

.confirm-wrap {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.confirm-frame {
  width: 100%;
  height: min(70vh, 640px);
  border: 0;
  border-radius: 12px;
  background: #fff;
}

.confirm-fallback {
  margin: 0;
  text-align: right;
  font-size: 0.8rem;
}

.confirm-fallback a {
  color: var(--muted);
  border-bottom: 0;
}

.inv-view {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: min(80vh, 760px);
}

.inv-bar {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--elevated);
  flex: 0 0 auto;
}

.inv-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
}

.inv-sort {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: var(--code-bg);
  border: 1px solid var(--line);
}

.inv-sort-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  padding: 7px 11px;
  border-radius: 8px;
  cursor: pointer;
}

.inv-sort-btn:hover {
  color: var(--ink);
}

.inv-sort-btn.is-active {
  background: var(--elevated-strong);
  color: var(--ink);
}

.inv-filter-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 750;
}

.inv-filter-input {
  width: 88px;
  padding: 7px 9px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: var(--code-bg);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
}

.inv-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.inv-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 96px;
  padding: 8px 11px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--code-bg);
}

.inv-stat span {
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 750;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.inv-stat b {
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 800;
}

.inv-stat-wide {
  min-width: 160px;
}

.inv-ok { color: #22c55e !important; }
.inv-cool { color: #e0b45c !important; }
.inv-bad { color: #fb6b6b !important; }

.inv-status-filter {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 3px;
  border-radius: 10px;
  background: var(--code-bg);
  border: 1px solid var(--line);
}

.inv-filter-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 0.78rem;
  font-weight: 750;
  padding: 7px 11px;
  border-radius: 8px;
  cursor: pointer;
}

.inv-filter-btn:hover { color: var(--ink); }
.inv-filter-btn.is-active {
  background: var(--elevated-strong);
  color: var(--ink);
}

.inv-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-left: auto;
}

.inv-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
  color: var(--ink-soft);
  font-size: 0.75rem;
  font-weight: 700;
}

.inv-chip b {
  color: var(--ink);
}

.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 10px;
  overflow: auto;
  padding: 2px 2px 10px;
  min-height: 0;
  flex: 1 1 auto;
}

.inv-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-height: 168px;
  padding: 12px 10px 11px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  text-align: center;
}

.inv-card:hover {
  border-color: var(--line-strong);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.03));
}

.inv-card-app {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 6px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid var(--line);
  color: var(--ink-soft);
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  line-height: 1.2;
}

.inv-card-img {
  width: 84px;
  height: 84px;
  object-fit: contain;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.28);
  margin-top: 4px;
}

.inv-card-img-empty {
  background: rgba(255, 255, 255, 0.04);
}

.inv-card-price {
  font-size: 0.8rem;
  font-weight: 850;
  line-height: 1;
}

.inv-card-price.is-ok,
.inv-price-ok { color: #22c55e; }
.inv-card-price.is-hold,
.inv-price-cool { color: #e0b45c; }
.inv-price-nt { color: #fb6b6b; }

.inv-card-name {
  font-size: 0.74rem;
  font-weight: 750;
  line-height: 1.25;
  color: var(--ink);
  max-width: 100%;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
}

.inv-card-status {
  margin-top: auto;
  max-width: 100%;
  padding: 3px 7px;
  border-radius: 999px;
  font-size: 0.66rem;
  font-weight: 750;
  line-height: 1.2;
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.inv-status-ok {
  color: #7dcea0;
  background: rgba(125, 206, 160, 0.12);
}

.inv-status-hold,
.inv-status-cool {
  color: #e0b45c;
  background: rgba(224, 180, 92, 0.14);
}

.inv-status-nt {
  color: #fb6b6b;
  background: rgba(251, 107, 107, 0.12);
}

/* legacy raw inv html (fallback) */
.inv-html {
  max-height: min(75vh, 640px);
  overflow: auto;
  background: var(--pre-bg);
  border-radius: var(--radius-xs);
  padding: 10px;
}

.inv-html img {
  max-width: 64px;
  height: auto;
}

.cookie-view {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: min(70vh, 640px);
  overflow: auto;
}

.cookie-line {
  margin: 0;
  color: var(--ink-soft);
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1.45;
}

.cookie-warn {
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  background: var(--danger-bg);
  color: var(--danger);
  font-size: 0.86rem;
  font-weight: 700;
  line-height: 1.45;
}

.cookie-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.cookie-label {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.cookie-ta {
  width: 100%;
  min-height: 120px;
  margin: 0;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--line-strong);
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.76rem;
  line-height: 1.35;
  resize: vertical;
  box-sizing: border-box;
  white-space: pre;
  overflow: auto;
}

.cookie-ta-lg {
  min-height: min(42vh, 360px);
}

.cookie-block:last-of-type .cookie-ta:not(.cookie-ta-lg) {
  min-height: 52px;
  white-space: pre-wrap;
}

.modal-footer-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  align-items: center;
}

.panel-html textarea {
  width: 100%;
  min-height: 145px;
  margin-top: 8px;
  padding: 10px;
  border-radius: var(--radius-xs);
  border: 1.5px solid var(--line-strong);
  background: var(--code-bg);
  color: var(--code-fg);
  font-family: ui-monospace, Consolas, monospace;
  font-size: 0.78rem;
  resize: vertical;
}

.panel-html p {
  margin: 0 0 10px;
  line-height: 1.4;
  font-weight: 600;
  color: var(--ink-soft);
}

.panel-html font,
.panel-html span,
.panel-html b {
  color: inherit !important;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes softPop {
  from { opacity: 0; transform: scale(0.94); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes barIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes blobFloat {
  from { transform: translate(-6%, -4%) rotate(-4deg); }
  to { transform: translate(4%, 6%) rotate(3deg); }
}

.panel-toasts {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom, 0px));
  transform: translateX(-50%);
  z-index: 80;
  display: flex;
  flex-direction: column-reverse;
  gap: 8px;
  align-items: center;
  width: min(420px, calc(100vw - 24px));
  pointer-events: none;
}

.panel-toast {
  width: 100%;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: var(--panel-solid);
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 800;
  text-align: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.panel-toast.is-show {
  opacity: 1;
  transform: translateY(0);
}

.panel-toast.is-ok {
  color: var(--ok);
  background: var(--ok-bg);
  border-color: rgba(78, 207, 138, 0.28);
}

.panel-toast.is-err {
  color: var(--danger);
  background: var(--danger-bg);
  border-color: rgba(239, 106, 90, 0.32);
}

@media (max-width: 960px) {
  .app-shell {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    flex: 0 0 auto;
    height: auto;
    position: sticky;
    top: 0;
    z-index: 40;
    padding: 10px 12px;
    gap: 10px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .sidebar-brand {
    padding: 0 2px;
  }
  .sidebar-label { display: none; }
  .sidebar-group {
    overflow: visible;
  }
  .sidebar-footer {
    flex-direction: row;
    align-items: center;
    border-top: 0;
    padding-top: 0;
  }
  .sidebar-logout {
    width: 40px;
  }
  .panel-tabs {
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    gap: 6px;
    scrollbar-width: none;
  }
  .panel-tabs::-webkit-scrollbar { display: none; }
  .panel-tab {
    width: auto;
    flex: 0 0 auto;
    min-height: 40px;
    padding: 8px 12px;
    font-size: 0.82rem;
    justify-content: center;
  }
  .panel-tab.is-active {
    box-shadow: none;
    background: var(--accent);
    color: var(--ink-inverse);
  }
  .panel-tab svg { width: 16px; height: 16px; }
}

@media (max-width: 720px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 8px; }
  .topbar {
    flex-wrap: nowrap;
    padding: 10px 12px;
    gap: 8px;
    position: sticky;
    top: 0;
    z-index: 30;
  }
  .topbar-right { gap: 6px; }
  .user-chip {
    max-width: 88px;
    font-size: 0.78rem;
    padding: 4px 8px;
  }
  .brand-mark { width: 28px; height: 28px; }
  .wrap {
    width: calc(100% - 16px);
    padding-bottom: 28px;
  }
  .card {
    padding: 14px 12px;
    border-radius: 16px;
  }
  .mafile-head {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .mafile-head-actions,
  .mafile-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .mafile-toolbar input[type="search"] {
    min-width: 0;
    width: 100%;
  }
  .row {
    flex-direction: column;
    align-items: stretch;
  }
  .row .btn { width: 100%; min-height: 44px; }
  .btn, .btn-sm, .cell-btn {
    min-height: 40px;
    padding: 8px 12px;
  }
  .mbtn {
    min-height: 36px;
    padding: 6px 10px;
    font-size: 0.78rem !important;
  }

  .mafile-table-wrap,
  .table-wrap {
    overflow: visible;
    max-height: none;
    background: transparent;
    border: none;
    box-shadow: none;
  }
  .mafile-table,
  .table-wrap table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0 10px;
  }
  .mafile-table thead,
  .table-wrap table thead {
    display: none;
  }
  .mafile-table tbody tr.mobile-card-row,
  .table-wrap tbody tr.mobile-card-row {
    display: block;
    background: var(--panel-solid);
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 10px 12px;
    box-shadow: var(--shadow-sm);
  }
  .mafile-table tbody td,
  .table-wrap tbody td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    border: 0 !important;
    padding: 8px 0 !important;
    white-space: normal !important;
    position: static !important;
    background: transparent !important;
  }
  .mafile-table tbody td + td,
  .table-wrap tbody td + td {
    border-top: 1px solid var(--line);
  }
  .mafile-table tbody td::before,
  .table-wrap tbody td::before {
    content: attr(data-label);
    flex: 0 0 38%;
    max-width: 42%;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.02em;
  }
  .mafile-table tbody td[data-label=""]::before,
  .table-wrap tbody td[data-label=""]::before {
    display: none;
  }
  .mafile-table tbody td > .cell-center,
  .mafile-table tbody td > .actions,
  .table-wrap tbody td > .actions {
    flex: 1;
    justify-content: flex-end;
    text-align: right;
  }
  .sid-cell .cell-center-left {
    justify-content: flex-end;
    text-align: right;
  }
  .mobile-actions .mafile-actions,
  .mobile-actions .actions {
    justify-content: flex-end;
    flex-wrap: wrap;
  }
  .mafile-actions {
    gap: 6px;
  }
  .note-input,
  .mindep-input {
    width: 100%;
    max-width: 160px;
    min-height: 38px;
  }
  .mindep-cell {
    justify-content: flex-end;
    flex-wrap: wrap;
  }

  .modal-backdrop {
    padding: 0;
    align-items: stretch;
  }
  .modal,
  .modal-wide,
  .modal-screen {
    width: 100%;
    max-width: none;
    min-height: 100%;
    max-height: none;
    border-radius: 0;
    padding: 16px 14px 24px;
  }
  .modal-footer-actions {
    position: sticky;
    bottom: 0;
    background: var(--panel-solid);
    padding-top: 10px;
  }
  .inv-bar,
  .inv-controls {
    flex-direction: column;
    align-items: stretch;
  }
  .inv-sort,
  .inv-status-filter {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
  }
  .prices-modal .modal { min-height: auto; }
  .login-wrap { padding: 20px 14px; }
  .login-card { width: 100%; padding: 22px 18px; }
  .panel-toast-host {
    left: 10px;
    right: 10px;
    bottom: 12px;
  }
}

@media (max-width: 420px) {
  .stats,
  .admin-stats { grid-template-columns: 1fr; }
  .user-chip { display: none; }
}

