/* ===========================================================================
   BALAN-X 報思捷 — application styles
   ---------------------------------------------------------------------------
   Palette comes straight from the brand brief:
     • 螢光綠 Neon Green   → growth / reconciled / 核對無誤  (PRIMARY action)
     • 尖銳橙紅 Sharp Red  → risk radar / momentum / 業務躍升 (SEMANTIC only)
   The pair echoes the market's 綠升紅跌 rhythm, so green always means "good
   / go" and red always means "down / risk". Never use red for a primary CTA.

   Brand rationale lives in public/brand/README.md.
   =========================================================================== */

:root {
  color-scheme: light;

  /* --- brand core -------------------------------------------------------- */
  --bx-neon: #c6ff4d; /* highlighter green */
  --bx-neon-deep: #4fcf0e;
  --bx-red: #f03212; /* sharp orange-red */
  --bx-red-deep: #ce1d06;

  /* --- surfaces (warm off-white so the neon reads clean) ----------------- */
  --bg: #f7f8f5;
  --surface: #ffffff;
  --surface-2: #f1f3ee;
  --surface-3: #e6e9e0;
  --border: #e2e6da;
  --border-strong: #c9cfc0;

  /* --- text (near-black ink; never tint body copy) ----------------------- */
  --text: #0a0e13;
  --text-2: #4a5560;
  --text-3: #78838f;

  /* --- accent = neon green. Text on it is INK, never white. -------------- */
  --accent: #4fcf0e;
  --accent-hover: #3fb00a;
  --accent-soft: #eaffcc;
  --accent-text: #0a0e13;

  /* --- semantic: red is risk only ---------------------------------------- */
  --success: #2c8308;
  --success-soft: #e8ffd1;
  --warn: #a45a00;
  --warn-soft: #fff2dc;
  --danger: #d8280f;
  --danger-soft: #ffe8e2;

  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 18px;
  --shadow-sm: 0 1px 2px rgba(10, 14, 19, 0.06), 0 1px 3px rgba(10, 14, 19, 0.04);
  --shadow: 0 4px 14px rgba(10, 14, 19, 0.08), 0 1px 3px rgba(10, 14, 19, 0.04);
  --shadow-lg: 0 22px 52px rgba(10, 14, 19, 0.18);

  --font: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang HK', 'Microsoft JhengHei',
    'Noto Sans TC', 'Helvetica Neue', Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, 'SF Mono', Menlo, Consolas, monospace;

  --sidebar-w: 248px;
  --header-h: 60px;
}

@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #07090c;
    --surface: #10141a;
    --surface-2: #171c24;
    --surface-3: #202632;
    --border: #242b36;
    --border-strong: #364050;
    --text: #eef2f6;
    --text-2: #a8b3c0;
    --text-3: #78838f;

    /* In the dark, neon IS the accent and carries ink text. */
    --accent: #c6ff4d;
    --accent-hover: #d6ff7a;
    --accent-soft: #1e2a10;
    --accent-text: #0a0e13;

    --success: #c6ff4d;
    --success-soft: #1e2a10;
    --warn: #f5b959;
    --warn-soft: #2b2313;
    --danger: #ff6a52;
    --danger-soft: #2e100b;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.5);
    --shadow: 0 6px 20px rgba(0, 0, 0, 0.5);
    --shadow-lg: 0 26px 60px rgba(0, 0, 0, 0.65);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

h1,
h2,
h3,
h4 {
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.011em;
  line-height: 1.25;
}
h1 {
  font-size: 1.75rem;
}
h2 {
  font-size: 1.28rem;
}
h3 {
  font-size: 1.05rem;
}
p {
  margin: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

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

/* --- brand devices ------------------------------------------------------ */

/* Highlighter mark: the signature device. A neon swipe behind key words, drawn
   slightly oversized and tilted so it reads as a real marker stroke. */
.hl {
  position: relative;
  display: inline-block;
  white-space: nowrap;
  z-index: 0;
}
.hl::before {
  content: '';
  position: absolute;
  left: -0.12em;
  right: -0.12em;
  bottom: 0.04em;
  height: 0.62em;
  background: var(--bx-neon);
  transform: rotate(-1.2deg);
  border-radius: 2px;
  z-index: -1;
}
/* On dark surfaces the neon already glows; soften the alpha. */
@media (prefers-color-scheme: dark) {
  .hl::before {
    opacity: 0.85;
  }
}

/* Risk stripe: a thin orange-red rule used on overdue / risk blocks. */
.risk-stripe {
  border-left: 3px solid var(--bx-red);
  padding-left: 12px;
}

/* --- layout ------------------------------------------------------------- */

#root {
  min-height: 100%;
}

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 16px;
}
/* BALAN-X mark: the X on a highlighter swipe, echoing the primary lockup. */
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--bx-red);
  background-image: linear-gradient(135deg, #ff6a3a 0%, var(--bx-red) 55%, var(--bx-red-deep) 100%);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 17px;
  letter-spacing: -0.02em;
  flex: none;
  position: relative;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(240, 50, 18, 0.3);
}
.brand-mark::after {
  /* the neon tick inside the X */
  content: '';
  position: absolute;
  right: 3px;
  top: 4px;
  width: 9px;
  height: 5px;
  border-left: 2.5px solid var(--bx-neon);
  border-bottom: 2.5px solid var(--bx-neon);
  transform: rotate(-45deg);
  border-radius: 1px;
}
.brand-name {
  font-weight: 800;
  font-size: 1.02rem;
  letter-spacing: -0.01em;
}
.brand-tenant {
  font-size: 0.76rem;
  color: var(--text-3);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 150px;
}

.nav-group-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-3);
  padding: 14px 10px 6px;
  font-weight: 600;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-2);
  font-size: 0.92rem;
  font-weight: 500;
  min-height: 40px;
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
  text-decoration: none;
}
.nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.nav-item .ico {
  width: 18px;
  text-align: center;
  flex: none;
  opacity: 0.85;
}

.main {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--header-h);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar h1 {
  font-size: 1.15rem;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.content {
  padding: 24px;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
  flex: 1;
}

/* --- primitives --------------------------------------------------------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 0 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-weight: 550;
  font-size: 0.92rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.btn:hover {
  background: var(--surface-2);
  text-decoration: none;
}
.btn:active {
  transform: translateY(1px);
}
.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
}
.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
}
.btn-danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 40%, var(--border));
  background: var(--danger-soft);
}
.btn-ghost {
  border-color: transparent;
  background: transparent;
}
.btn-ghost:hover {
  background: var(--surface-2);
}
.btn-sm {
  min-height: 32px;
  padding: 0 11px;
  font-size: 0.84rem;
}
.btn-lg {
  min-height: 48px;
  padding: 0 24px;
  font-size: 1rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.card-pad {
  padding: 20px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
}

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

/* Main column + narrow sidebar (dashboard, document detail). */
.split-2 {
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
}

.stat {
  padding: 18px 20px;
}
.stat-label {
  font-size: 0.8rem;
  color: var(--text-3);
  font-weight: 550;
  letter-spacing: 0.01em;
}
.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.stat-sub {
  font-size: 0.8rem;
  color: var(--text-3);
  margin-top: 2px;
}
.stat-value.is-danger {
  color: var(--danger);
}
.stat-value.is-warn {
  color: var(--warn);
}
.stat-value.is-success {
  color: var(--success);
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-2);
  white-space: nowrap;
}
.badge-success {
  background: var(--success-soft);
  color: var(--success);
}
.badge-warn {
  background: var(--warn-soft);
  color: var(--warn);
}
.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}
.badge-accent {
  background: var(--accent-soft);
  color: var(--accent);
}

/* --- forms -------------------------------------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}
.field label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-2);
}
.field .hint {
  font-size: 0.76rem;
  color: var(--text-3);
}
.field .err {
  font-size: 0.78rem;
  color: var(--danger);
  font-weight: 550;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 42px;
  padding: 9px 12px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  font-size: 0.94rem;
  transition: border-color 0.12s, box-shadow 0.12s;
}
.textarea {
  min-height: 84px;
  resize: vertical;
  line-height: 1.5;
}
.input:focus,
.select:focus,
.textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 20%, transparent);
}
.input[aria-invalid='true'] {
  border-color: var(--danger);
}
.input-num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
}

.row {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
}
.row-tight {
  gap: 8px;
}
.spacer {
  flex: 1;
}

/* --- tables ------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
th {
  text-align: left;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-3);
  font-weight: 650;
  padding: 10px 14px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
  white-space: nowrap;
}
td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td {
  border-bottom: none;
}
tbody tr:hover {
  background: var(--surface-2);
}
.num {
  text-align: right;
  font-variant-numeric: tabular-nums;
  font-family: var(--mono);
  font-size: 0.88rem;
}
.mono {
  font-family: var(--mono);
  font-size: 0.86rem;
}
.nowrap {
  white-space: nowrap;
}
.ellipsis {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 320px;
}

.empty {
  padding: 48px 24px;
  text-align: center;
  color: var(--text-3);
}
.empty h3 {
  color: var(--text-2);
  margin-bottom: 6px;
}

/* --- misc --------------------------------------------------------------- */

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.alert-danger {
  background: var(--danger-soft);
  border-color: color-mix(in srgb, var(--danger) 35%, transparent);
  color: var(--danger);
}
.alert-success {
  background: var(--success-soft);
  border-color: color-mix(in srgb, var(--success) 35%, transparent);
  color: var(--success);
}
.alert-warn {
  background: var(--warn-soft);
  border-color: color-mix(in srgb, var(--warn) 35%, transparent);
  color: var(--warn);
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 999px;
  font-size: 0.9rem;
  font-weight: 550;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  max-width: min(560px, calc(100vw - 32px));
}
.toast.is-error {
  background: var(--danger);
  color: #fff;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid color-mix(in srgb, var(--text-3) 35%, transparent);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(9, 14, 26, 0.55);
  display: grid;
  place-items: center;
  padding: 20px;
  z-index: 90;
  backdrop-filter: blur(3px);
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  width: min(760px, 100%);
  max-height: min(88vh, 900px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-head {
  padding: 20px 24px 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.modal-body {
  padding: 18px 24px;
  overflow-y: auto;
  flex: 1;
}
.modal-foot {
  padding: 14px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  background: var(--surface-2);
}

.tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  overflow-x: auto;
}
.tab {
  padding: 10px 14px;
  border: none;
  background: none;
  color: var(--text-2);
  font-weight: 550;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  min-height: 42px;
}
.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.line-table {
  width: 100%;
  border-collapse: collapse;
}
.line-table th {
  font-size: 0.72rem;
  padding: 8px;
  background: transparent;
}
.line-table td {
  padding: 6px 6px;
  border-bottom: 1px solid var(--border);
}
.line-table .input,
.line-table .select {
  min-height: 38px;
  padding: 6px 9px;
  font-size: 0.88rem;
}
.totals {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-end;
  margin-top: 14px;
  font-variant-numeric: tabular-nums;
}
.totals-row {
  display: grid;
  grid-template-columns: auto 140px;
  gap: 16px;
  font-size: 0.92rem;
}
.totals-row span:first-child {
  color: var(--text-2);
  text-align: right;
}
.totals-row.grand {
  font-size: 1.1rem;
  font-weight: 700;
  padding-top: 8px;
  border-top: 2px solid var(--text);
}

/* --- auth / marketing --------------------------------------------------- */

.auth-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.auth-hero {
  /* The highlighter board: ink surface with a neon swipe and a red risk stripe,
     so even the login page teaches the brand's colour meaning. */
  background:
    radial-gradient(120% 90% at 85% 8%, rgba(198, 255, 77, 0.22) 0%, transparent 55%),
    radial-gradient(90% 70% at 10% 100%, rgba(240, 50, 18, 0.28) 0%, transparent 60%),
    linear-gradient(155deg, #0a0e13 0%, #131a23 55%, #0a0e13 100%);
  color: #fff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 22px;
  position: relative;
  overflow: hidden;
}
/* The hero carries the brand through the reversed logo, the ink surface and the
   neon discs on each bullet — no decorative bars, which kept landing on copy. */
.auth-hero h2 {
  font-size: 2.1rem;
  line-height: 1.2;
  letter-spacing: -0.025em;
  position: relative;
}
.auth-hero p {
  font-size: 1.02rem;
  opacity: 0.86;
  max-width: 44ch;
  line-height: 1.6;
  position: relative;
}
.hero-points {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 8px;
  position: relative;
}
.hero-point {
  display: flex;
  gap: 11px;
  align-items: flex-start;
  font-size: 0.96rem;
  opacity: 0.95;
}
.hero-point .dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--bx-neon);
  color: var(--bx-ink);
  display: grid;
  place-items: center;
  flex: none;
  font-size: 0.72rem;
  font-weight: 800;
  margin-top: 1px;
}

.auth-panel {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  background: var(--bg);
}
.auth-card {
  width: min(440px, 100%);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.auth-card h1 {
  font-size: 1.6rem;
}
.auth-sub {
  color: var(--text-2);
  font-size: 0.95rem;
}
.auth-links {
  display: flex;
  justify-content: space-between;
  font-size: 0.88rem;
  color: var(--text-3);
}

.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 16px;
}
.plan {
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  position: relative;
}
.plan.is-current {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 16%, transparent);
}
.plan-price {
  font-size: 1.9rem;
  font-weight: 750;
  letter-spacing: -0.03em;
}
.plan-price small {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-3);
  letter-spacing: 0;
}
.plan ul {
  margin: 6px 0 0;
  padding-left: 18px;
  color: var(--text-2);
  font-size: 0.87rem;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bar {
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}
.bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
  transition: width 0.3s;
}
.bar.is-full > span {
  background: var(--danger);
}

.hamburger {
  display: none;
}

/* --- responsive --------------------------------------------------------- */

@media (max-width: 1100px) {
  .split-2 {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 960px) {
  .grid-4 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .auth-wrap {
    grid-template-columns: 1fr;
  }
  .auth-hero {
    display: none;
  }
}

@media (max-width: 760px) {
  .app {
    grid-template-columns: 1fr;
  }
  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    width: 82vw;
    max-width: 320px;
    z-index: 80;
    transform: translateX(-102%);
    transition: transform 0.22s ease;
    box-shadow: var(--shadow-lg);
  }
  .sidebar.open {
    transform: none;
  }
  .sidebar-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(9, 14, 26, 0.5);
    z-index: 70;
  }
  .hamburger {
    display: inline-flex;
  }
  .content {
    padding: 16px;
  }
  .topbar {
    padding: 0 16px;
  }
  .grid-2,
  .grid-3,
  .grid-4 {
    grid-template-columns: 1fr;
  }
  h1 {
    font-size: 1.4rem;
  }
  .stat-value {
    font-size: 1.35rem;
  }
  /* Tables become cards on phones so nothing is hidden behind horizontal scroll. */
  .stack-mobile thead {
    display: none;
  }
  .stack-mobile tbody tr {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 4px 12px;
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    align-items: baseline;
  }
  .stack-mobile tbody td {
    padding: 2px 0;
    border: none;
    display: flex;
    gap: 8px;
    align-items: baseline;
    min-width: 0;
  }
  /* Each cell shows its column name so the card stays readable without a header. */
  .stack-mobile tbody td[data-label]::before {
    content: attr(data-label);
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex: none;
    min-width: 3.5em;
  }
  .stack-mobile tbody td.num {
    text-align: right;
    justify-content: flex-end;
  }
  .stack-mobile tbody td.ellipsis {
    display: block;
    max-width: none;
    white-space: normal;
  }
  .stack-mobile tbody td.ellipsis::before {
    display: block;
    margin-bottom: 1px;
  }
  /* The first cell (reference) spans the full width as the card title. */
  .stack-mobile tbody tr > td:first-child {
    grid-column: 1 / -1;
    font-weight: 600;
    font-size: 1rem;
  }
  .stack-mobile tbody tr > td:first-child::before {
    display: none;
  }
  .stack-mobile tbody tr > td:last-child {
    grid-column: 1 / -1;
    margin-top: 4px;
  }
  .modal {
    max-height: 94vh;
  }
  .modal-body {
    padding: 16px;
  }
  .modal-head,
  .modal-foot {
    padding-left: 16px;
    padding-right: 16px;
  }
}

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

/* Print: invoices and reports only */
@media print {
  .sidebar,
  .topbar,
  .btn,
  .no-print {
    display: none !important;
  }
  .app {
    grid-template-columns: 1fr;
  }
  .content {
    padding: 0;
  }
  .card {
    box-shadow: none;
    border: none;
  }
}
