:root {
  --mint-50: #effcf7;
  --mint-100: #dcf7ec;
  --mint-200: #b8ebd8;
  --mint-400: #45c49a;
  --mint-500: #1cad7f;
  --mint-600: #0b8f69;
  --mint-700: #087054;
  --ink-950: #17231f;
  --ink-800: #2c3a35;
  --ink-650: #53625c;
  --ink-500: #7b8883;
  --ink-350: #aab4b0;
  --line: #e4ebe8;
  --line-strong: #d6e2dd;
  --canvas: #f5f8f7;
  --surface: #ffffff;
  --blue: #2d74da;
  --blue-soft: #edf5ff;
  --amber: #aa6d15;
  --amber-soft: #fff7e7;
  --danger: #c94d4d;
  --danger-soft: #fff1f1;
  --shadow-sm: 0 8px 24px rgba(28, 57, 47, 0.055);
  --shadow-lg: 0 24px 65px rgba(22, 53, 43, 0.13);
  --sidebar-width: 238px;
}

* { box-sizing: border-box; }

html {
  min-width: 320px;
  min-height: 100%;
  background: var(--canvas);
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink-950);
  background:
    radial-gradient(circle at 88% 0, rgba(28, 173, 127, 0.08), transparent 26rem),
    var(--canvas);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
}

button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; }
a { color: inherit; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.9em; }
h1, h2, h3, p { margin-top: 0; }

.is-hidden { display: none !important; }
.desktop-only { display: inline-flex; }

.boot-screen {
  display: grid;
  min-height: 100vh;
  place-content: center;
  justify-items: center;
  gap: 14px;
  color: var(--ink-500);
}

.boot-screen p { margin: 0; font-size: 12px; }

.brand-symbol {
  display: inline-grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 14px;
  color: white;
  background: linear-gradient(145deg, var(--mint-400), var(--mint-700));
  box-shadow: 0 10px 24px rgba(11, 143, 105, 0.22);
  font-size: 25px;
  font-weight: 750;
  letter-spacing: -1px;
}

.brand-lockup {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.brand-lockup strong { display: block; font-size: 23px; letter-spacing: -0.7px; }
.brand-lockup small { display: block; margin-top: 2px; color: var(--ink-650); font-size: 11px; }
.eyebrow { margin-bottom: 7px; color: var(--mint-600); font-size: 10px; font-weight: 750; letter-spacing: 1.45px; }

/* Authentication */
.auth-shell { display: grid; min-height: 100vh; grid-template-columns: minmax(420px, 1.15fr) minmax(420px, 0.85fr); }

.auth-story {
  position: relative;
  display: flex;
  min-height: 100vh;
  flex-direction: column;
  padding: clamp(36px, 6vw, 78px);
  overflow: hidden;
  background:
    linear-gradient(140deg, rgba(225, 250, 240, 0.96), rgba(246, 252, 249, 0.94)),
    white;
}

.auth-story::before,
.auth-story::after {
  position: absolute;
  border: 1px solid rgba(28, 173, 127, 0.14);
  border-radius: 50%;
  content: "";
}

.auth-story::before { width: 430px; height: 430px; right: -170px; top: -130px; }
.auth-story::after { width: 680px; height: 680px; right: -250px; top: -225px; }
.auth-story .brand-lockup { position: relative; z-index: 1; align-self: flex-start; }
.auth-story-copy { position: relative; z-index: 1; width: min(690px, 100%); margin: auto 0; }
.auth-story-copy h1 { margin-bottom: 22px; font-size: clamp(35px, 4.3vw, 61px); line-height: 1.13; letter-spacing: -2.8px; }
.auth-story-copy > p:last-child { width: min(570px, 100%); margin: 0; color: var(--ink-650); font-size: 15px; line-height: 1.9; }
.trust-strip { position: relative; z-index: 1; display: flex; flex-wrap: wrap; gap: 9px; }
.trust-strip span { padding: 8px 11px; border: 1px solid rgba(11, 143, 105, 0.12); border-radius: 999px; color: var(--mint-700); background: rgba(255, 255, 255, 0.66); font-size: 10px; }

.auth-panel { display: grid; min-height: 100vh; padding: 36px; place-items: center; background: rgba(255, 255, 255, 0.72); }
.auth-card { width: min(420px, 100%); }
.mobile-brand { display: none; }
.auth-tabs { display: grid; grid-template-columns: repeat(3, 1fr); margin-bottom: 31px; border-bottom: 1px solid var(--line); }
.auth-tab { position: relative; padding: 13px; border: 0; color: var(--ink-500); background: transparent; }
.auth-tab.is-active { color: var(--ink-950); font-weight: 700; }
.auth-tab.is-active::after { position: absolute; right: 14%; bottom: -1px; left: 14%; height: 2px; border-radius: 2px; background: var(--mint-500); content: ""; }
.auth-heading { margin-bottom: 24px; }
.auth-heading h2 { margin-bottom: 8px; font-size: 28px; letter-spacing: -0.9px; }
.auth-heading p { margin-bottom: 0; color: var(--ink-650); line-height: 1.65; }
.auth-form { display: grid; gap: 17px; }
.field { display: grid; gap: 8px; color: var(--ink-650); font-size: 12px; }
.field input, .field select {
  width: 100%;
  height: 47px;
  padding: 0 13px;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: none;
  color: var(--ink-950);
  background: white;
}
.field input:focus, .field select:focus { border-color: var(--mint-500); box-shadow: 0 0 0 3px rgba(28, 173, 127, 0.11); }
.code-field { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; }
.code-field .text-button { min-width: 105px; border: 1px solid var(--mint-200); border-radius: 11px; background: var(--mint-50); }
.agreement-row { display: flex; align-items: flex-start; gap: 9px; color: var(--ink-650); font-size: 11px; line-height: 1.55; }
.agreement-row input { margin-top: 2px; accent-color: var(--mint-600); }
.form-status { min-height: 20px; margin: 14px 0 0; color: var(--danger); font-size: 12px; text-align: center; }
.form-status.is-success { color: var(--mint-700); }
.api-notice { display: none; gap: 5px; margin-top: 18px; padding: 13px; border: 1px solid #f1dfb9; border-radius: 11px; color: var(--amber); background: var(--amber-soft); font-size: 11px; line-height: 1.55; }
.api-notice.is-visible { display: grid; }

/* Shared buttons */
.primary-button, .secondary-button, .disabled-button, .text-button, .icon-button {
  display: inline-flex;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-weight: 650;
}
.primary-button { padding: 0 17px; border: 1px solid var(--mint-600); color: white; background: var(--mint-600); }
.primary-button:hover { background: var(--mint-700); }
.secondary-button { padding: 0 16px; border: 1px solid var(--line-strong); color: var(--ink-800); background: white; }
.secondary-button:hover { border-color: var(--mint-200); color: var(--mint-700); }
.disabled-button { padding: 0 16px; border: 1px solid var(--line); color: var(--ink-500); background: #f1f4f3; }
.text-button { min-height: 34px; padding: 0 6px; border: 0; color: var(--mint-700); background: transparent; font-size: 12px; }
.text-button:disabled { color: var(--ink-350); }
.icon-button { width: 39px; padding: 0; border: 1px solid var(--line-strong); color: var(--ink-800); background: white; font-size: 18px; }
.full-button { width: 100%; min-height: 47px; margin-top: 4px; }

/* Application layout */
.customer-shell { min-height: 100vh; }
.desktop-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  display: flex;
  width: var(--sidebar-width);
  flex-direction: column;
  padding: 24px 18px 20px;
  overflow-y: auto;
  border-right: 1px solid rgba(8, 112, 84, 0.1);
  background: linear-gradient(180deg, #dff8ee 0%, #eefaf5 46%, #fff 100%);
}
.sidebar-brand { padding: 0 8px 28px; }
.desktop-nav { display: grid; gap: 5px; }
.nav-caption { margin: 15px 12px 5px; color: var(--ink-500); font-size: 9px; font-weight: 750; letter-spacing: 1.15px; }
.nav-item { display: flex; width: 100%; align-items: center; gap: 12px; padding: 11px 13px; border: 0; border-radius: 11px; color: var(--ink-800); background: transparent; text-align: left; }
.nav-item span { display: grid; width: 22px; place-items: center; color: var(--ink-650); font-size: 17px; }
.nav-item b { font-size: 13px; font-weight: 560; }
.nav-item:hover { background: rgba(255, 255, 255, 0.65); }
.nav-item.is-active { color: var(--mint-700); background: white; box-shadow: 0 8px 24px rgba(28, 90, 69, 0.07); }
.nav-item.is-active span { color: var(--mint-600); }
.nav-item.is-active b { font-weight: 700; }
.sidebar-footnote { display: flex; gap: 10px; margin-top: auto; padding: 13px; border: 1px solid rgba(11, 143, 105, 0.13); border-radius: 13px; background: rgba(255, 255, 255, 0.72); }
.sidebar-footnote strong, .sidebar-footnote small { display: block; }
.sidebar-footnote strong { font-size: 11px; }
.sidebar-footnote small { margin-top: 4px; color: var(--ink-500); font-size: 9px; line-height: 1.5; }
.live-dot { width: 8px; height: 8px; flex: 0 0 auto; margin-top: 3px; border-radius: 50%; background: var(--mint-500); box-shadow: 0 0 0 4px rgba(28, 173, 127, 0.12); }

.workspace { min-height: 100vh; margin-left: var(--sidebar-width); }
.workspace-header { position: sticky; top: 0; z-index: 20; display: flex; min-height: 76px; align-items: center; gap: 14px; padding: 10px 32px; border-bottom: 1px solid rgba(220, 229, 225, 0.88); background: rgba(255, 255, 255, 0.88); backdrop-filter: blur(16px); }
.mobile-header-brand { display: none; }
.header-copy p { margin-bottom: 3px; color: var(--mint-600); font-size: 8px; font-weight: 750; letter-spacing: 1.3px; }
.header-copy h1 { margin: 0; font-size: 17px; letter-spacing: -0.3px; }
.header-actions { display: flex; align-items: center; gap: 9px; margin-left: auto; }
.account-chip { display: inline-flex; min-height: 38px; align-items: center; gap: 8px; padding: 4px 11px 4px 5px; border: 1px solid var(--line); border-radius: 999px; background: white; }
.account-chip i { display: grid; width: 28px; height: 28px; place-items: center; border-radius: 50%; color: var(--mint-700); background: var(--mint-100); font-size: 11px; font-style: normal; font-weight: 750; }
.account-chip span { max-width: 120px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.workspace-content { width: min(1500px, 100%); margin: 0 auto; padding: 31px 32px 48px; }
.view-panel { display: none; }
.view-panel.is-active { display: block; animation: view-in 180ms ease; }
@keyframes view-in { from { opacity: 0; transform: translateY(3px); } to { opacity: 1; transform: translateY(0); } }
.global-banner { margin-bottom: 16px; padding: 12px 14px; border: 1px solid #f1dfb9; border-radius: 11px; color: var(--amber); background: var(--amber-soft); font-size: 12px; line-height: 1.55; }

/* Page structure */
.hero-card { display: flex; min-height: 190px; align-items: flex-end; justify-content: space-between; gap: 26px; padding: clamp(26px, 4vw, 43px); overflow: hidden; border: 1px solid var(--mint-200); border-radius: 20px; background: linear-gradient(127deg, #e7faf3 0%, #fff 72%); box-shadow: var(--shadow-sm); }
.hero-card h2 { max-width: 700px; margin-bottom: 10px; font-size: clamp(24px, 3vw, 37px); line-height: 1.25; letter-spacing: -1.2px; }
.hero-card p:last-child { margin-bottom: 0; color: var(--ink-650); }
.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 21px; }
.page-intro h2 { margin-bottom: 7px; font-size: clamp(25px, 3vw, 33px); letter-spacing: -1px; }
.page-intro > div > p:last-child { max-width: 730px; margin-bottom: 0; color: var(--ink-650); line-height: 1.65; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 14px; }
.section-heading h2 { margin: 0; font-size: 17px; }

.metric-grid, .summary-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin: 17px 0; }
.metric-card, .summary-card { min-height: 125px; padding: 19px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: var(--shadow-sm); }
.metric-card span, .summary-card span { color: var(--ink-650); font-size: 11px; }
.metric-card strong, .summary-card strong { display: block; margin: 17px 0 7px; font-size: 28px; letter-spacing: -0.8px; }
.metric-card small, .summary-card small { color: var(--ink-500); font-size: 10px; }
.summary-card.is-negative { border-color: #efcaca; background: #fff8f8; }
.summary-card.is-negative strong { color: var(--danger); }
.summary-card.is-warning { border-color: #f1dfb9; background: #fffaf0; }
.current-account-summary { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.section-divider-heading { margin: 34px 0 15px; padding-top: 24px; border-top: 1px solid var(--line); }
.section-divider-heading h3 { margin: 0 0 6px; font-size: 18px; }
.section-divider-heading p:last-child { margin: 0; color: var(--ink-500); font-size: 11px; line-height: 1.6; }
.two-column-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.surface-card { padding: 20px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: var(--shadow-sm); }
.stack-list { display: grid; gap: 9px; }
.stack-item { display: flex; min-height: 63px; align-items: center; gap: 12px; padding: 11px 12px; border-radius: 11px; background: #f8faf9; }
.stack-item-mark { display: grid; width: 35px; height: 35px; flex: 0 0 auto; place-items: center; border-radius: 11px; color: var(--mint-700); background: var(--mint-100); font-size: 12px; font-weight: 750; }
.stack-item-main { min-width: 0; flex: 1; }
.stack-item-main strong, .stack-item-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stack-item-main strong { font-size: 12px; }
.stack-item-main small { margin-top: 4px; color: var(--ink-500); font-size: 10px; }
.empty-state { display: grid; min-height: 128px; place-content: center; justify-items: center; color: var(--ink-500); text-align: center; }
.empty-state strong { color: var(--ink-650); font-size: 12px; }
.empty-state small { max-width: 320px; margin-top: 6px; font-size: 10px; line-height: 1.55; }

/* Filters and lists */
.filter-card { display: grid; align-items: end; gap: 11px; margin-bottom: 14px; padding: 16px; border: 1px solid var(--line); border-radius: 15px; background: white; box-shadow: var(--shadow-sm); }
.product-filters { grid-template-columns: 155px 155px minmax(220px, 1fr) auto auto; }
.order-filters { grid-template-columns: 155px 155px minmax(220px, 1fr) auto auto; }
.compact-filters { grid-template-columns: 190px 190px auto; }
.customer-filters { grid-template-columns: minmax(240px, 1fr) auto auto; }
.filter-card label { display: grid; gap: 7px; color: var(--ink-650); font-size: 10px; }
.filter-card input, .filter-card select { width: 100%; height: 39px; padding: 0 10px; border: 1px solid var(--line-strong); border-radius: 9px; outline: none; color: var(--ink-950); background: white; }
.filter-card input:focus, .filter-card select:focus { border-color: var(--mint-500); box-shadow: 0 0 0 3px rgba(28, 173, 127, 0.1); }
.result-meta { display: flex; min-height: 40px; align-items: center; justify-content: space-between; gap: 20px; color: var(--ink-500); font-size: 10px; }
.result-meta > span:first-child { color: var(--ink-800); font-size: 11px; }
.product-grid, .customer-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.product-card, .customer-card, .renewal-card { position: relative; padding: 19px; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: var(--shadow-sm); }
.product-card { display: flex; min-height: 265px; flex-direction: column; }
.product-card-head { display: flex; align-items: flex-start; gap: 10px; }
.product-card-head > div { min-width: 0; flex: 1; }
.product-card h3, .renewal-card h3 { margin-bottom: 6px; font-size: 15px; line-height: 1.45; }
.product-card-head p, .renewal-card p { margin: 0; color: var(--ink-500); font-size: 10px; }
.product-points { display: -webkit-box; margin: 16px 0; overflow: hidden; color: var(--ink-650); font-size: 11px; line-height: 1.65; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
.tag-row { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.tag, .supplier-badge, .readonly-badge { display: inline-flex; align-items: center; padding: 5px 8px; border-radius: 999px; color: var(--mint-700); background: var(--mint-50); font-size: 9px; font-weight: 650; }
.product-card-actions { display: flex; gap: 8px; margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); }
.product-card-actions button { flex: 1; }
.status-pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; color: var(--ink-650); background: #f1f4f3; font-size: 9px; white-space: nowrap; }
.status-pill::before { width: 5px; height: 5px; border-radius: 50%; background: currentColor; content: ""; }
.status-pill.is-positive { color: var(--mint-700); background: var(--mint-50); }
.status-pill.is-warning { color: var(--amber); background: var(--amber-soft); }
.status-pill.is-negative { color: var(--danger); background: var(--danger-soft); }
.status-pill.is-info { color: var(--blue); background: var(--blue-soft); }

.data-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: white; box-shadow: var(--shadow-sm); }
.data-card-head { display: flex; min-height: 47px; align-items: center; justify-content: space-between; gap: 16px; padding: 0 17px; border-bottom: 1px solid var(--line); color: var(--ink-800); font-size: 11px; }
.data-card-head small { color: var(--ink-500); }
.responsive-table { overflow-x: auto; }
table { width: 100%; min-width: 920px; border-collapse: collapse; }
th { padding: 13px 15px; color: var(--ink-650); background: #fafcfb; font-size: 10px; font-weight: 650; text-align: left; white-space: nowrap; }
td { padding: 14px 15px; border-top: 1px solid #edf1ef; color: var(--ink-800); font-size: 11px; line-height: 1.5; vertical-align: middle; }
tbody tr:hover { background: #fbfdfc; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 10px; }
.money { font-variant-numeric: tabular-nums; font-weight: 680; }
.table-action { padding: 6px 9px; border: 1px solid var(--mint-200); border-radius: 8px; color: var(--mint-700); background: var(--mint-50); font-size: 10px; }
.mobile-card-list { display: none; }
.pager { display: flex; min-height: 54px; align-items: center; justify-content: flex-end; gap: 7px; padding: 9px 14px; }
.pager:empty { display: none; }
.pager button { min-width: 74px; height: 33px; border: 1px solid var(--line-strong); border-radius: 9px; color: var(--ink-800); background: white; font-size: 10px; }
.pager button:disabled { opacity: 0.42; }
.pager span { margin: 0 5px; color: var(--ink-500); font-size: 10px; }

.segmented-tabs { display: inline-flex; gap: 3px; margin-bottom: 14px; padding: 4px; border: 1px solid var(--line); border-radius: 11px; background: white; }
.segmented-tabs button { min-height: 34px; padding: 0 15px; border: 0; border-radius: 8px; color: var(--ink-650); background: transparent; font-size: 11px; }
.segmented-tabs button.is-active { color: var(--mint-700); background: var(--mint-100); font-weight: 700; }
.renewal-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.renewal-card-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.renewal-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 11px; margin-top: 16px; padding: 14px; border-radius: 11px; background: #f8faf9; }
.renewal-meta span, .detail-grid dt { display: block; color: var(--ink-500); font-size: 9px; }
.renewal-meta strong { display: block; margin-top: 5px; overflow-wrap: anywhere; font-size: 11px; }
.renewal-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; margin-top: 13px; }
.readonly-callout { display: flex; align-items: flex-start; gap: 12px; margin-bottom: 14px; padding: 13px 15px; border: 1px solid #f1dfb9; border-radius: 12px; color: var(--amber); background: var(--amber-soft); font-size: 11px; line-height: 1.55; }
.readonly-callout strong { flex: 0 0 auto; }
.current-account-callout { border-color: var(--mint-200); color: var(--mint-700); background: var(--mint-50); }
.current-account-callout.is-reconciling { border-color: #f1dfb9; color: var(--amber); background: var(--amber-soft); }
.current-account-callout.is-debt { border-color: #efcaca; color: var(--danger); background: #fff4f4; }
.withdrawal-rule-callout { border-color: var(--mint-200); color: var(--mint-700); background: var(--mint-50); }
.withdrawal-month-card { margin-bottom: 14px; }
.withdrawal-action:disabled { cursor: not-allowed; opacity: 0.48; }
.entry-direction-credit { color: var(--mint-700); }
.entry-direction-debit { color: var(--danger); }

.customer-card-head { display: flex; align-items: center; gap: 11px; }
.customer-avatar { display: grid; width: 39px; height: 39px; place-items: center; border-radius: 12px; color: var(--mint-700); background: var(--mint-100); font-size: 13px; font-weight: 750; }
.customer-card h3 { margin: 0 0 4px; font-size: 14px; }
.customer-card p { margin: 0; color: var(--ink-500); font-size: 10px; }
.customer-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-top: 15px; }
.customer-stat { padding: 10px 7px; border-radius: 10px; background: #f8faf9; text-align: center; }
.customer-stat strong, .customer-stat span { display: block; }
.customer-stat strong { font-size: 13px; }
.customer-stat span { margin-top: 4px; color: var(--ink-500); font-size: 8px; }

.invite-layout, .profile-layout { display: grid; grid-template-columns: minmax(320px, 0.8fr) minmax(420px, 1.2fr); gap: 16px; }
.invite-card { position: relative; min-height: 360px; padding: 28px; overflow: hidden; border-radius: 20px; color: white; background: linear-gradient(145deg, var(--mint-500), #086448); box-shadow: var(--shadow-lg); }
.invite-card .eyebrow { color: rgba(255, 255, 255, 0.72); }
.invite-card h2 { max-width: 330px; font-size: 27px; line-height: 1.25; letter-spacing: -0.8px; }
.invite-card > p:not(.eyebrow) { max-width: 380px; color: rgba(255, 255, 255, 0.78); line-height: 1.65; }
.invite-mark { position: absolute; right: -20px; top: -62px; color: rgba(255, 255, 255, 0.08); font-size: 240px; font-weight: 200; }
.invite-link-box { position: relative; margin: 34px 0 12px; padding: 13px; overflow-wrap: anywhere; border: 1px solid rgba(255, 255, 255, 0.23); border-radius: 11px; background: rgba(255, 255, 255, 0.1); font-size: 10px; line-height: 1.5; }
.invite-card .primary-button { position: relative; border-color: white; color: var(--mint-700); background: white; }

.profile-card { display: grid; min-height: 330px; place-content: center; justify-items: center; padding: 27px; border: 1px solid var(--mint-200); border-radius: 20px; background: linear-gradient(150deg, var(--mint-50), white); box-shadow: var(--shadow-sm); text-align: center; }
.profile-avatar { display: grid; width: 82px; height: 82px; place-items: center; border: 6px solid white; border-radius: 26px; color: white; background: linear-gradient(145deg, var(--mint-400), var(--mint-700)); box-shadow: 0 12px 28px rgba(11, 143, 105, 0.2); font-size: 26px; font-weight: 750; }
.profile-card h2 { margin: 18px 0 7px; }
.profile-card p { margin-bottom: 16px; color: var(--ink-500); }
.profile-details dl { display: grid; grid-template-columns: 1fr 1fr; margin: 0 0 16px; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.profile-details dl > div { min-height: 73px; padding: 13px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.profile-details dl > div:nth-child(2n) { border-right: 0; }
.profile-details dt { margin-bottom: 7px; color: var(--ink-500); font-size: 9px; }
.profile-details dd { margin: 0; overflow-wrap: anywhere; color: var(--ink-800); font-size: 11px; }
.mobile-more-grid { display: none; }

/* Detail drawer and toast */
.drawer-backdrop { position: fixed; inset: 0; z-index: 70; background: rgba(20, 34, 29, 0.28); backdrop-filter: blur(2px); }
.detail-drawer { position: fixed; z-index: 75; top: 0; right: 0; bottom: 0; width: min(650px, 95vw); overflow-y: auto; background: white; box-shadow: -24px 0 60px rgba(22, 53, 43, 0.18); transform: translateX(105%); transition: transform 190ms ease; }
.detail-drawer.is-open { transform: translateX(0); }
.detail-drawer > header { position: sticky; top: 0; z-index: 2; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; padding: 22px 24px 17px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, 0.94); backdrop-filter: blur(13px); }
.detail-drawer h2 { margin: 0; font-size: 20px; }
.drawer-content { padding: 23px 24px 38px; }
.detail-section { margin-bottom: 24px; }
.detail-section h3 { margin-bottom: 11px; font-size: 13px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; margin: 0; overflow: hidden; border: 1px solid var(--line); border-radius: 12px; }
.detail-grid > div { min-height: 69px; padding: 12px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.detail-grid > div:nth-child(2n) { border-right: 0; }
.detail-grid dd { margin: 6px 0 0; overflow-wrap: anywhere; color: var(--ink-800); font-size: 11px; line-height: 1.5; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 9px; }
.toast { position: fixed; z-index: 100; left: 50%; bottom: 28px; max-width: min(430px, calc(100vw - 32px)); padding: 11px 15px; border-radius: 10px; color: white; background: rgba(23, 35, 31, 0.92); box-shadow: var(--shadow-lg); font-size: 11px; line-height: 1.5; opacity: 0; pointer-events: none; transform: translate(-50%, 15px); transition: 180ms ease; }
.toast.is-visible { opacity: 1; transform: translate(-50%, 0); }
.mobile-bottom-nav { display: none; }

@media (max-width: 1180px) {
  .metric-grid, .summary-grid, .current-account-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-grid, .customer-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .product-filters, .order-filters { grid-template-columns: repeat(2, minmax(150px, 1fr)); }
  .product-filters .search-field, .order-filters .search-field { grid-column: span 2; }
}

@media (max-width: 820px) {
  body { background: var(--canvas); }
  .auth-shell { display: block; min-height: 100vh; }
  .auth-story { display: none; }
  .auth-panel { min-height: 100vh; padding: 28px 20px; background: linear-gradient(180deg, #ddf8ed 0, var(--canvas) 240px); }
  .mobile-brand { display: flex; align-items: center; gap: 9px; margin-bottom: 28px; }
  .mobile-brand .brand-symbol { width: 36px; height: 36px; border-radius: 12px; font-size: 21px; }
  .mobile-brand strong { font-size: 21px; }
  .auth-card { padding: 24px 20px; border: 1px solid rgba(255, 255, 255, 0.85); border-radius: 20px; background: rgba(255, 255, 255, 0.96); box-shadow: var(--shadow-lg); }

  .desktop-sidebar { display: none; }
  .workspace { margin-left: 0; padding-bottom: calc(72px + env(safe-area-inset-bottom)); }
  .workspace-header { min-height: 63px; padding: 9px 16px; }
  .mobile-header-brand { display: flex; align-items: center; gap: 7px; }
  .mobile-header-brand .brand-symbol { width: 31px; height: 31px; border-radius: 10px; font-size: 18px; box-shadow: none; }
  .mobile-header-brand strong { font-size: 18px; }
  .header-copy { display: none; }
  .account-chip { display: none; }
  .desktop-only { display: none; }
  .workspace-content { padding: 18px 14px 25px; }

  .mobile-bottom-nav { position: fixed; z-index: 45; right: 0; bottom: 0; left: 0; display: grid; min-height: calc(61px + env(safe-area-inset-bottom)); grid-template-columns: repeat(5, 1fr); padding: 5px 6px env(safe-area-inset-bottom); border-top: 1px solid rgba(219, 228, 224, 0.94); background: rgba(255, 255, 255, 0.96); box-shadow: 0 -8px 25px rgba(28, 57, 47, 0.06); backdrop-filter: blur(15px); }
  .mobile-bottom-nav button { display: grid; place-items: center; gap: 2px; border: 0; color: var(--ink-500); background: transparent; }
  .mobile-bottom-nav button span { font-size: 18px; line-height: 1; }
  .mobile-bottom-nav button b { font-size: 9px; font-weight: 550; }
  .mobile-bottom-nav button.is-active { color: var(--mint-700); }
  .mobile-bottom-nav button.is-active b { font-weight: 750; }

  .hero-card { min-height: 210px; align-items: flex-start; flex-direction: column; padding: 24px 20px; border-radius: 18px; }
  .hero-card h2 { font-size: 25px; }
  .hero-card .primary-button { margin-top: auto; }
  .metric-grid, .summary-grid, .current-account-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .metric-card, .summary-card { min-height: 111px; padding: 15px; border-radius: 14px; }
  .metric-card strong, .summary-card strong { margin: 14px 0 5px; font-size: 23px; }
  .two-column-grid, .invite-layout, .profile-layout { grid-template-columns: 1fr; }
  .surface-card { padding: 16px; border-radius: 15px; }
  .page-intro { align-items: flex-start; flex-direction: column; gap: 12px; margin-bottom: 17px; }
  .page-intro h2 { font-size: 26px; }
  .page-intro .disabled-button { width: 100%; }

  .filter-card, .product-filters, .order-filters, .compact-filters, .customer-filters { grid-template-columns: 1fr 1fr; padding: 13px; }
  .filter-card .search-field, .product-filters .search-field, .order-filters .search-field, .customer-filters .search-field { grid-column: 1 / -1; }
  .product-grid, .customer-grid, .renewal-list { grid-template-columns: 1fr; }
  .product-card { min-height: 230px; }
  .result-meta { align-items: flex-start; flex-direction: column; gap: 3px; padding: 5px 1px 10px; }
  .responsive-table { display: none; }
  .mobile-card-list { display: grid; gap: 10px; padding: 12px; }
  .mobile-data-card { padding: 14px; border: 1px solid var(--line); border-radius: 13px; background: #fbfdfc; }
  .mobile-data-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 11px; }
  .mobile-data-card h3 { margin-bottom: 5px; font-size: 13px; line-height: 1.45; }
  .mobile-data-card p { margin: 0; color: var(--ink-500); font-size: 9px; }
  .mobile-data-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 13px; }
  .mobile-data-grid span, .mobile-data-grid strong { display: block; }
  .mobile-data-grid span { color: var(--ink-500); font-size: 8px; }
  .mobile-data-grid strong { margin-top: 4px; overflow-wrap: anywhere; font-size: 10px; }
  .mobile-data-card footer { display: flex; justify-content: flex-end; margin-top: 12px; }
  .pager { justify-content: center; }
  .renewal-meta { grid-template-columns: 1fr; }
  .readonly-callout { flex-direction: column; gap: 4px; }
  .invite-card { min-height: 330px; padding: 24px 20px; }
  .invite-card h2 { font-size: 24px; }
  .profile-card { min-height: 270px; }
  .profile-details dl { grid-template-columns: 1fr; }
  .profile-details dl > div { border-right: 0; }
  .mobile-more-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 14px; }
  .mobile-more-grid button { display: flex; min-height: 62px; align-items: center; gap: 9px; padding: 12px; border: 1px solid var(--line); border-radius: 13px; color: var(--ink-800); background: white; text-align: left; }
  .mobile-more-grid button span { display: grid; width: 31px; height: 31px; place-items: center; border-radius: 9px; color: var(--mint-700); background: var(--mint-100); }
  .detail-drawer { width: 100%; top: 8vh; border-radius: 20px 20px 0 0; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-grid > div { border-right: 0; }
  .toast { bottom: calc(76px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .filter-card, .product-filters, .order-filters, .compact-filters, .customer-filters { grid-template-columns: 1fr; }
  .filter-card .search-field, .product-filters .search-field, .order-filters .search-field, .customer-filters .search-field { grid-column: auto; }
  .metric-grid, .summary-grid { grid-template-columns: 1fr 1fr; }
}

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