:root {
  --green: #0cb378;
  --green-dark: #079b67;
  --green-soft: #dff8ef;
  --black: #0e0e0e;
  --ink: #171918;
  --muted: #757b78;
  --gray: #eaeaea;
  --gray-2: #f3f3f1;
  --gray-3: #d9dcda;
  --white: #fff;
  --danger: #f06464;
  --danger-soft: #fff0ee;
  --amber: #d28a19;
  --amber-soft: #fff5df;
  --blue: #5478da;
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow: 0 18px 50px rgba(14, 14, 14, .08);
}

* { box-sizing: border-box; }

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

body {
  font-family: Montserrat, Arial, sans-serif;
  color: var(--ink);
  background: #eceeeb;
  -webkit-font-smoothing: antialiased;
}

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

.app-shell {
  width: min(1560px, calc(100vw - 32px));
  min-height: calc(100vh - 32px);
  margin: 16px auto;
  display: grid;
  grid-template-columns: 226px minmax(0, 1fr);
  background: var(--white);
  border-radius: 32px;
  overflow: hidden;
  box-shadow: 0 22px 70px rgba(14, 14, 14, .12);
}

.sidebar {
  min-height: calc(100vh - 32px);
  padding: 24px 16px 18px;
  display: flex;
  flex-direction: column;
  background: #f4f4f2;
  border-right: 1px solid #e5e6e3;
}

.brand { display: flex; align-items: center; gap: 11px; color: var(--black); text-decoration: none; padding: 0 8px 26px; }
.brand-mark { width: 36px; height: 36px; position: relative; display: inline-block; }
.brand-mark i { position: absolute; display: block; width: 12px; height: 28px; border-radius: 8px; background: var(--green); transform: rotate(38deg); }
.brand-mark i:nth-child(1) { left: 4px; top: 4px; }
.brand-mark i:nth-child(2) { left: 13px; top: 4px; opacity: .65; }
.brand-mark i:nth-child(3) { left: 22px; top: 4px; opacity: .32; }
.brand b { display: block; font-size: 15px; letter-spacing: .09em; }
.brand small { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; font-weight: 600; letter-spacing: .14em; }

.side-nav { display: grid; gap: 6px; }
.nav-item { width: 100%; min-height: 46px; padding: 0 12px; display: grid; grid-template-columns: 26px 1fr auto; align-items: center; gap: 8px; border: 0; border-radius: 14px; background: transparent; color: #626764; text-align: left; font-size: 13px; font-weight: 600; transition: .18s ease; }
.side-nav a.nav-item { text-decoration: none; }
.nav-item:hover { background: #e9eae7; color: var(--black); }
.nav-item.active { background: var(--black); color: var(--white); }
.nav-icon { width: 26px; height: 26px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 9px; font-size: 15px; }
.nav-item em { min-width: 24px; padding: 3px 7px; border-radius: 999px; background: #dedfdd; color: #686c69; font-size: 10px; font-style: normal; text-align: center; }
.nav-item.active em { background: rgba(255,255,255,.15); color: #fff; }
.nav-item em.alert { background: var(--green); color: #fff; }

.side-section { margin-top: 28px; padding: 0 8px; }
.side-section > span { display: block; margin-bottom: 10px; color: #999e9b; font-size: 9px; font-weight: 700; letter-spacing: .14em; }
.side-section button { width: 100%; padding: 9px 2px; display: flex; align-items: center; gap: 8px; border: 0; background: transparent; color: #6e736f; font-size: 11px; text-align: left; }
.side-section button b { margin-left: auto; color: var(--green-dark); font-size: 8px; text-transform: uppercase; }
.side-section button.active { color: var(--green-dark); font-weight: 700; }
.side-section button.active .service-dot { border-color: var(--green); background: var(--green); box-shadow: 0 0 0 4px rgba(12,179,120,.12); }
.service-dot { width: 7px; height: 7px; border: 1px solid #aaa; border-radius: 50%; }
.service-dot.green { border-color: var(--green); background: var(--green); box-shadow: 0 0 0 4px rgba(12,179,120,.12); }

.user-card { margin-top: auto; padding: 11px; display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 9px; border-radius: 16px; background: #e9eae7; }
.avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; background: var(--green); color: white; font-size: 11px; font-weight: 700; }
.user-card b, .user-card small { display: block; }
.user-card b { font-size: 10px; }
.user-card small { margin-top: 3px; color: var(--muted); font-size: 8px; }
.user-card button { border: 0; background: none; color: var(--muted); }

.workspace { min-width: 0; background: #fafaf8; }
.topbar { height: 70px; padding: 0 26px; display: flex; align-items: center; gap: 14px; border-bottom: 1px solid #e8e9e6; background: rgba(255,255,255,.88); backdrop-filter: blur(16px); }
.crumb { display: flex; align-items: center; gap: 9px; min-width: 265px; font-size: 11px; }
.crumb span, .crumb i { color: #a0a5a1; font-style: normal; }
.global-search { width: min(350px, 30vw); height: 38px; margin-left: auto; display: flex; align-items: center; gap: 8px; padding: 0 12px; border-radius: 13px; background: var(--gray-2); color: var(--muted); }
.global-search input { width: 100%; border: 0; outline: 0; background: transparent; font-size: 10px; }
.icon-button { position: relative; width: 38px; height: 38px; border: 1px solid #e1e3e0; border-radius: 13px; background: white; }
.icon-button span { position: absolute; width: 7px; height: 7px; right: 7px; top: 7px; border: 2px solid white; border-radius: 50%; background: var(--green); }
.primary-button { min-height: 40px; padding: 0 17px; border: 0; border-radius: 13px; background: var(--green); color: white; font-size: 10px; font-weight: 700; box-shadow: 0 8px 20px rgba(12,179,120,.22); }
.primary-button:hover { background: var(--green-dark); transform: translateY(-1px); }

.period-bar { min-height: 66px; padding: 10px 26px; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #e9eae7; background: white; }
.period-arrow { width: 30px; height: 30px; border: 1px solid #e3e4e1; border-radius: 10px; background: white; }
.period-copy { min-width: 142px; }
.period-copy small, .period-copy strong { display: block; }
.period-copy small { color: var(--muted); font-size: 8px; }
.period-copy strong { margin-top: 3px; font-size: 11px; }
.month-strip { display: flex; gap: 5px; overflow: hidden; }
.month-chip { padding: 7px 9px; border: 0; border-radius: 9px; background: transparent; color: #929793; font-size: 9px; }
.month-chip:hover { background: #f2f3f0; }
.month-chip.active { background: var(--green-soft); color: var(--green-dark); font-weight: 700; }
.period-status { margin-left: auto; display: flex; align-items: center; gap: 7px; color: #727773; font-size: 9px; white-space: nowrap; }
.period-status i { width: 7px; height: 7px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }

.page { padding: 24px 26px 34px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.eyebrow { margin: 0 0 7px; color: var(--green-dark); font-size: 9px; font-weight: 700; letter-spacing: .14em; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 5px; font-size: clamp(23px, 2.1vw, 34px); line-height: 1.05; letter-spacing: -.04em; }
.page-head p { margin-bottom: 0; color: var(--muted); font-size: 10px; }
.secondary-button, .ghost-button { min-height: 38px; padding: 0 14px; border: 1px solid #dedfdd; border-radius: 13px; background: white; color: var(--ink); font-size: 9px; font-weight: 600; }
.ghost-button { border-color: transparent; background: #f1f2ef; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.metric-card { position: relative; min-height: 138px; padding: 18px; overflow: hidden; border: 1px solid #e5e6e3; border-radius: 22px; background: white; }
.metric-card::after { content: ''; position: absolute; width: 62px; height: 62px; right: -18px; top: -19px; border-radius: 18px; transform: rotate(24deg); background: var(--gray-2); }
.metric-card.accent { border-color: var(--green); background: var(--green); color: white; }
.metric-card.accent::after { background: rgba(255,255,255,.16); }
.metric-label { display: flex; justify-content: space-between; gap: 8px; color: var(--muted); font-size: 9px; font-weight: 600; }
.metric-card.accent .metric-label { color: rgba(255,255,255,.75); }
.metric-value { margin: 21px 0 10px; font-size: clamp(20px, 2vw, 30px); font-weight: 700; letter-spacing: -.05em; }
.metric-note { color: var(--muted); font-size: 8px; }
.metric-card.accent .metric-note { color: rgba(255,255,255,.74); }
.trend { color: var(--green-dark); font-weight: 700; }
.metric-card.accent .trend { color: white; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(280px, .75fr); gap: 16px; }
.panel { border: 1px solid #e5e6e3; border-radius: 24px; background: white; overflow: hidden; }
.panel-head { min-height: 64px; padding: 15px 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid #ececea; }
.panel-head h2 { margin-bottom: 4px; font-size: 13px; }
.panel-head p { margin-bottom: 0; color: var(--muted); font-size: 8px; }
.panel-head a { color: var(--green-dark); font-size: 9px; font-weight: 700; text-decoration: none; }

.chart { height: 230px; padding: 24px 20px 18px; display: flex; align-items: flex-end; gap: 14px; }
.chart-group { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 8px; }
.bars { width: 100%; height: 180px; display: flex; justify-content: center; align-items: flex-end; gap: 4px; border-bottom: 1px solid #e8e9e6; }
.bar { width: min(21px, 38%); min-height: 6px; border-radius: 7px 7px 2px 2px; background: var(--green); transition: height .3s ease; }
.bar.cost { background: #dfe2df; }
.chart-group.active .bars { background: linear-gradient(to top, var(--green-soft), transparent 70%); border-radius: 10px; }
.chart-group span { color: var(--muted); font-size: 8px; }

.task-list { padding: 4px 16px 14px; }
.task { padding: 13px 2px; display: grid; grid-template-columns: 32px 1fr auto; gap: 10px; align-items: center; border-bottom: 1px solid #efefed; }
.task:last-child { border-bottom: 0; }
.task-icon { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 11px; background: var(--gray-2); font-size: 13px; }
.task-icon.warn { background: var(--amber-soft); color: var(--amber); }
.task-icon.refund { background: var(--danger-soft); color: var(--danger); }
.task b, .task small { display: block; }
.task b { font-size: 9px; }
.task small { margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.35; }
.task strong { color: var(--green-dark); font-size: 9px; }

.quick-row { margin-top: 16px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.quick-card { min-height: 112px; padding: 16px; display: flex; flex-direction: column; border: 1px solid #e5e6e3; border-radius: 22px; background: #f3f4f1; text-align: left; }
.quick-card:nth-child(2) { background: var(--black); color: white; }
.quick-card:nth-child(3) { background: var(--green-soft); }
.quick-card span { width: 31px; height: 31px; display: grid; place-items: center; border-radius: 10px; background: white; color: var(--black); }
.quick-card b { margin-top: auto; font-size: 10px; }
.quick-card small { margin-top: 4px; color: var(--muted); font-size: 8px; }
.quick-card:nth-child(2) small { color: #aeb3af; }

.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.date-presets { display: flex; align-items: center; gap: 5px; padding: 4px; border-radius: 14px; background: #ecedea; }
.date-preset { min-height: 32px; padding: 0 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 8px; font-weight: 600; }
.date-preset.active { background: white; color: var(--black); box-shadow: 0 3px 10px rgba(14,14,14,.08); }
.daily-summary { display: grid; grid-template-columns: 1.1fr repeat(3, minmax(120px,.65fr)); gap: 10px; margin-bottom: 14px; }
.daily-main { padding: 19px 21px; border-radius: 22px; background: var(--green); color: white; position: relative; overflow: hidden; }
.daily-main::after { content:''; position:absolute; right:-32px; top:-50px; width:120px; height:120px; border:22px solid rgba(255,255,255,.18); border-radius:50%; }
.daily-main small, .daily-mini small { display:block; font-size:8px; }
.daily-main small { color:rgba(255,255,255,.72); }
.daily-main strong { display:block; margin-top:12px; font-size:26px; letter-spacing:-.04em; }
.daily-main span { display:block; margin-top:6px; font-size:8px; }
.daily-mini { padding:17px; border:1px solid #e4e5e2; border-radius:20px; background:white; }
.daily-mini small { color:var(--muted); }
.daily-mini strong { display:block; margin-top:13px; font-size:16px; }
.daily-mini span { display:block; margin-top:5px; color:var(--muted); font-size:7px; }
.service-cell b, .service-cell small { display:block; }
.service-cell small { margin-top:4px; color:var(--muted); font-size:7px; }
.sales-table { min-width: 1320px; }
.applicant-names { min-width: 210px; display: grid; gap: 4px; line-height: 1.3; }
.applicant-names span { display: block; }
.applicant-count { text-align: center; font-weight: 700; }
.sales-total td { background:#f4fbf8; font-weight:700; }
.table-search { flex: 1; min-width: 180px; height: 40px; padding: 0 13px; border: 1px solid #dedfdd; border-radius: 13px; background: white; outline: 0; font-size: 9px; }
.filter-button { height: 40px; padding: 0 13px; border: 1px solid #dedfdd; border-radius: 13px; background: white; font-size: 9px; }
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { padding: 11px 14px; border-bottom: 1px solid #e9eae7; background: #f6f6f4; color: #898e8a; font-size: 8px; text-align: left; font-weight: 600; }
.data-table th.sortable-date { cursor: pointer; user-select: none; white-space: nowrap; transition: color .18s ease, background .18s ease; }
.data-table th.sortable-date:hover, .data-table th.sortable-date:focus-visible { color: var(--green); background: #eef8f3; outline: none; }
.date-sort-marker { display: inline-flex; align-items: center; justify-content: center; min-width: 15px; margin-left: 5px; color: var(--green); font-size: 10px; font-weight: 800; }
.data-table td { padding: 13px 14px; border-bottom: 1px solid #eeeeec; font-size: 9px; }
.data-table tbody tr { transition: .15s; }
.data-table tbody tr:hover { background: #f5fcf9; }
.data-table tbody tr[data-client] { cursor: pointer; }
.data-table tbody tr[data-sale] { cursor: pointer; }
.client-link, .deal-link { margin: 0; padding: 0; border: 0; background: transparent; font: inherit; text-align: left; cursor: pointer; }
.client-link { display: block; color: var(--green-dark); font-weight: 700; text-decoration: underline; text-decoration-color: #a8dfcb; text-underline-offset: 3px; }
.deal-link { display: block; margin-top: 3px; color: var(--muted); font-size: 7px; }
.client-link:hover, .deal-link:hover { color: var(--black); }
.client-cell { display: flex; align-items: center; gap: 10px; }
.client-cell .avatar { width: 30px; height: 30px; font-size: 9px; }
.client-cell b, .client-cell small { display: block; }
.client-cell small { margin-top: 3px; color: var(--muted); font-size: 7px; }
.money { white-space: nowrap; font-weight: 600; }
.money.green { color: var(--green-dark); }
.money.red { color: var(--danger); }
.cost-cell { min-width: 112px; }
.cost-edit { min-height: 30px; padding: 6px 8px; display: inline-flex; align-items: center; gap: 7px; border: 1px solid transparent; border-radius: 9px; background: transparent; color: var(--black); font: inherit; font-weight: 600; cursor: pointer; transition: .16s ease; }
.cost-edit span { color: #929893; font-size: 8px; opacity: .72; transition: .16s ease; }
.cost-edit:hover, .cost-edit:focus-visible { border-color: #cfd3cf; background: white; outline: none; }
.cost-edit:hover span, .cost-edit:focus-visible span, .cost-edit.empty span { opacity: 1; }
.cost-edit.empty { border-color: #b9e8d7; background: var(--green-soft); color: var(--green-dark); }
.cost-editor { display: inline-grid; grid-template-columns: 72px 26px 26px; align-items: center; gap: 4px; }
.cost-editor input { width: 72px; height: 30px; padding: 0 7px; border: 1px solid var(--green); border-radius: 8px; background: white; color: var(--black); font: inherit; font-weight: 600; outline: none; }
.cost-editor button { width: 26px; height: 26px; display: grid; place-items: center; border: 0; border-radius: 8px; background: #eef0ed; color: var(--muted); cursor: pointer; }
.cost-editor button[type="submit"] { background: var(--green); color: white; }
.cost-editor button:disabled, .cost-editor input:disabled { opacity: .55; cursor: wait; }
.dds-operation-form { padding-top: 16px; }
.dds-link-note { padding: 13px 14px; display: flex; align-items: center; gap: 11px; border-radius: 14px; background: var(--green-soft); color: var(--green-dark); }
.dds-link-note > span { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; background: white; font-size: 16px; }
.dds-link-note b, .dds-link-note small { display: block; }
.dds-link-note b { font-size: 9px; }
.dds-link-note small { margin-top: 4px; color: #50816f; font-size: 7px; line-height: 1.45; }
.dds-link-note.unlinked { background: #f0f1ef; color: var(--black); }
.dds-link-note.unlinked small { color: var(--muted); }
.linked-sale { background: var(--green-soft); color: var(--green-dark); }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 999px; background: #f0f1ef; color: #666b68; font-size: 7px; font-weight: 700; white-space: nowrap; }
.pill::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.pill.green { background: var(--green-soft); color: var(--green-dark); }
.pill.amber { background: var(--amber-soft); color: var(--amber); }
.pill.red { background: var(--danger-soft); color: var(--danger); }

.profile-hero { display: grid; grid-template-columns: 1fr auto; gap: 18px; padding: 22px; border-radius: 26px; background: var(--black); color: white; overflow: hidden; position: relative; }
.profile-hero::after { content:''; position:absolute; width:190px; height:190px; right:-70px; top:-90px; border:35px solid rgba(12,179,120,.35); border-radius:50%; }
.profile-title { display: flex; align-items: center; gap: 15px; position: relative; z-index: 1; }
.profile-title .avatar { width: 52px; height: 52px; font-size: 14px; }
.profile-title h1 { margin: 0; font-size: 24px; }
.profile-title p { margin: 6px 0 0; color: #adb2ae; font-size: 9px; }
.profile-actions { display: flex; align-items: center; gap: 8px; position: relative; z-index: 1; }
.profile-actions button { min-height: 38px; padding: 0 13px; border: 1px solid rgba(255,255,255,.2); border-radius: 12px; background: rgba(255,255,255,.08); color: white; font-size: 8px; }
.profile-actions .refund-button { border-color: var(--green); background: var(--green); }
.profile-actions .button-link { min-height: 38px; padding: 0 13px; display: inline-flex; align-items: center; border: 1px solid rgba(255,255,255,.2); border-radius: 12px; background: rgba(255,255,255,.08); color: white; font-size: 8px; text-decoration: none; }
.test-banner { margin: 12px 0; padding: 12px 16px; display: flex; align-items: center; gap: 10px; border: 1px solid #b9e8d7; border-radius: 15px; background: var(--green-soft); color: var(--green-dark); font-size: 8px; }
.test-banner b { white-space: nowrap; }
.test-banner span { color: #50816f; }
.sale-layout { margin: 12px 0; display: grid; grid-template-columns: minmax(0,1.5fr) minmax(250px,.7fr); gap: 12px; }
.sale-info { padding: 16px 18px; display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.sale-info .full { grid-column: 1 / -1; }
.sale-info small, .sale-info b { display: block; }
.sale-info small { margin-bottom: 6px; color: var(--muted); font-size: 7px; }
.sale-info b { font-size: 10px; }
.sale-info ol { margin: 8px 0 0; padding-left: 18px; display: grid; gap: 6px; font-size: 9px; }
.sync-card { padding: 16px 18px; }
.sync-card p { margin-bottom: 14px; color: var(--muted); font-size: 8px; line-height: 1.55; }
.sale-section { margin-top: 12px; }
.payment-plan-panel { border-color: #bde8d8; }
.payment-plan-summary { padding: 11px 14px; display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; border-bottom: 1px solid #e7e9e6; background: #fbfefc; }
.payment-plan-summary > div { min-width: 0; }
.payment-plan-summary small, .payment-plan-summary b, .payment-plan-summary span { display: block; }
.payment-plan-summary small { color: var(--muted); font-size: 6px; letter-spacing: .08em; }
.payment-plan-summary b { margin-top: 4px; font-size: 12px; }
.payment-plan-summary span { margin-top: 3px; color: var(--muted); font-size: 7px; }
.payment-plan-warning { margin: 10px 14px 0; padding: 9px 11px; border-radius: 10px; background: #fff3dc; color: #9a650a; font-size: 7px; }
.modal.payment-plan-modal { width: min(820px,100%); }
.payment-plan-form { padding: 14px 22px 22px; }
.payment-stage-list { margin-top: 12px; display: grid; gap: 8px; }
.payment-stage-row { padding: 10px; display: grid; grid-template-columns: 25px minmax(120px,1.2fr) minmax(95px,.7fr) minmax(125px,.9fr) minmax(160px,1.2fr) 30px; align-items: end; gap: 7px; border: 1px solid #e1e5e2; border-radius: 13px; background: #fbfcfb; }
.payment-stage-number { width: 24px; height: 24px; display: grid; place-items: center; align-self: center; border-radius: 8px; background: var(--green-soft); color: var(--green-dark); font-size: 8px; font-weight: 800; }
.payment-stage-row label { min-width: 0; }
.payment-stage-row label small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 6px; }
.payment-stage-row input { width: 100%; height: 34px; padding: 0 8px; border: 1px solid #dfe3df; border-radius: 9px; background: #fff; color: var(--ink); font: inherit; font-size: 8px; outline: 0; }
.payment-stage-row input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(12,179,120,.08); }
.payment-stage-add { margin-top: 9px; }
.payment-plan-total { margin-top: 10px; padding: 10px 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-radius: 11px; font-size: 8px; }
.payment-plan-total.balanced { background: var(--green-soft); color: var(--green-dark); }
.payment-plan-total.warning { background: #fff3dc; color: #986205; }
.payment-plan-disable { margin-right: auto; width: auto; padding: 0 10px; color: var(--red); }
.primary-button.compact { min-height: 30px; padding: 0 9px; font-size: 7px; }
.secondary-button.compact { min-height: 30px; padding: 0 9px; font-size: 7px; white-space: nowrap; }
.allocation-actions { display: flex; align-items: center; gap: 6px; }
.allocation-note { padding: 13px 14px; display: flex; align-items: center; gap: 11px; border: 1px solid #c9eee0; border-radius: 14px; background: var(--green-soft); color: var(--green-dark); }
.allocation-note > span { width: 34px; height: 34px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 10px; background: #fff; font-size: 16px; }
.allocation-note b, .allocation-note small { display: block; }
.allocation-note b { font-size: 9px; }
.allocation-note small { margin-top: 4px; color: #50816f; font-size: 7px; line-height: 1.45; }
.modal-empty { min-height: 220px; }
.modal.allocation-modal { width: min(820px, 100%); }
.allocation-form { gap: 14px; }
.allocation-context { padding: 10px 12px; border: 1px solid #e4e7e4; border-radius: 14px; background: #f8f9f7; }
.allocation-context > small { display: block; margin-bottom: 7px; color: var(--muted); font-size: 6px; font-weight: 700; letter-spacing: .12em; }
.allocation-selected { display: flex; align-items: center; gap: 10px; }
.allocation-selected > div { min-width: 0; }
.allocation-selected b, .allocation-selected small { display: block; }
.allocation-selected b { font-size: 9px; }
.allocation-selected small { margin-top: 3px; color: var(--muted); font-size: 7px; }
.allocation-picker { padding: 13px; border: 1px solid #e1e5e2; border-radius: 17px; background: #fbfcfb; }
.allocation-picker > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; }
.allocation-picker h3 { margin: 0; font-size: 11px; }
.allocation-picker p { margin: 4px 0 0; color: var(--muted); font-size: 7px; }
.allocation-picker > header > small { color: var(--muted); font-size: 6px; white-space: nowrap; }
.allocation-toolbar { margin-top: 11px; display: grid; grid-template-columns: minmax(220px,1fr) auto auto; gap: 7px; }
.allocation-toolbar input, .allocation-toolbar select { min-height: 35px; padding: 0 10px; border: 1px solid #dfe3df; border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-size: 8px; outline: 0; }
.allocation-toolbar input:focus, .allocation-toolbar select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(12,179,120,.09); }
.allocation-candidates { margin-top: 9px; display: grid; gap: 6px; }
.allocation-candidate { width: 100%; padding: 9px 10px; display: grid; grid-template-columns: minmax(0,1fr) auto 58px; align-items: center; gap: 9px; border: 1px solid #e2e5e2; border-radius: 12px; background: #fff; color: var(--ink); text-align: left; }
.allocation-candidate:hover { border-color: #a8dcca; background: #f8fffc; }
.allocation-candidate.selected { border-color: var(--green); background: var(--green-soft); box-shadow: 0 0 0 2px rgba(12,179,120,.08); }
.candidate-main { min-width: 0; }
.candidate-main b, .candidate-main small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.candidate-main b { font-size: 8px; }
.candidate-main small { margin-top: 4px; color: var(--muted); font-size: 7px; }
.match-score { padding: 5px 7px; border-radius: 999px; background: #f0f1ef; color: #6f756f; font-size: 6px; font-weight: 700; white-space: nowrap; }
.match-score.medium { background: #fff4dc; color: #ae6b00; }
.match-score.strong { background: #daf5eb; color: var(--green-dark); }
.candidate-select { color: var(--green-dark); font-size: 7px; font-weight: 700; text-align: right; }
.allocation-show-all { width: 100%; margin-top: 8px; min-height: 31px; border: 1px dashed #cfd5d0; border-radius: 10px; background: transparent; color: var(--muted); font-size: 7px; font-weight: 700; }
.allocation-show-all:hover { border-color: var(--green); color: var(--green-dark); }
.allocation-empty { padding: 20px; color: var(--muted); font-size: 8px; text-align: center; }
.history-list { padding: 7px 18px 14px; }
.history-list > div { padding: 10px 0; display: flex; align-items: center; gap: 10px; border-bottom: 1px solid #eceeeb; }
.history-list > div:last-child { border-bottom: 0; }
.history-list > div > span { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 9px; background: var(--green-soft); color: var(--green-dark); }
.history-list p, .history-list b, .history-list small { margin: 0; display: block; }
.history-list b { font-size: 8px; }
.history-list small { margin-top: 4px; color: var(--muted); font-size: 7px; }
.dds-metrics { grid-template-columns: repeat(6,minmax(0,1fr)); }
.dds-table { min-width: 1240px; }
.control-equation { margin: -4px 0 12px; padding: 9px 13px; border-radius: 12px; background: #f1f2ef; color: var(--muted); font-size: 8px; }
.profile-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 12px 0; }
.profile-metric { padding: 15px; border: 1px solid #e4e5e2; border-radius: 19px; background: white; }
.profile-metric small { color: var(--muted); font-size: 8px; }
.profile-metric strong { display: block; margin-top: 10px; font-size: 17px; }
.profile-metric span { display: block; margin-top: 5px; color: var(--muted); font-size: 7px; }
.tab-row { margin-bottom: 12px; display: flex; gap: 5px; }
.tab-button { padding: 9px 13px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-size: 8px; font-weight: 600; }
.tab-button.active { background: var(--green-soft); color: var(--green-dark); }
.back-button { margin-bottom: 12px; padding: 0; border: 0; background: none; color: var(--muted); font-size: 9px; }

.empty-card { min-height: 360px; padding: 40px; display: grid; place-items: center; text-align: center; border: 1px solid #e5e6e3; border-radius: 26px; background: white; }
.empty-card span { width: 64px; height: 64px; margin: auto; display: grid; place-items: center; border-radius: 20px; background: var(--green-soft); color: var(--green-dark); font-size: 26px; }
.empty-card h2 { margin: 16px 0 8px; font-size: 17px; }
.empty-card p { max-width: 430px; color: var(--muted); font-size: 9px; line-height: 1.6; }

.modal-backdrop { position: fixed; inset: 0; z-index: 20; display: grid; place-items: center; padding: 18px; background: rgba(14,14,14,.48); backdrop-filter: blur(8px); }
.modal-backdrop[hidden] { display: none; }
.modal { width: min(570px, 100%); max-height: calc(100vh - 36px); overflow: auto; border-radius: 28px; background: white; box-shadow: var(--shadow); }
.modal > header { padding: 21px 23px 15px; display: flex; justify-content: space-between; border-bottom: 1px solid #ebebe9; }
.modal header small { color: var(--green-dark); font-size: 8px; font-weight: 700; letter-spacing: .13em; }
.modal header h2 { margin: 5px 0 0; font-size: 20px; }
.modal-close { width: 34px; height: 34px; border: 0; border-radius: 50%; background: #f1f2ef; font-size: 19px; }
.operation-types { padding: 14px 22px 6px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; }
.operation-type { min-height: 72px; padding: 10px; border: 1px solid #e1e2df; border-radius: 15px; background: white; text-align: left; }
.operation-type b, .operation-type small { display: block; }
.operation-type b { margin-top: 9px; font-size: 8px; }
.operation-type small { margin-top: 3px; color: var(--muted); font-size: 7px; }
.operation-type.active { border-color: var(--green); background: var(--green-soft); }
.modal-form { padding: 14px 22px 22px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { color: #646965; font-size: 8px; font-weight: 600; }
.field input, .field select, .field textarea { width: 100%; min-height: 42px; padding: 0 12px; border: 1px solid #dcdfdc; border-radius: 12px; background: white; outline: 0; font-size: 9px; }
.field textarea { padding-top: 11px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--green); box-shadow: 0 0 0 3px var(--green-soft); }
.refund-context { grid-column: 1 / -1; padding: 13px; border-radius: 14px; background: var(--danger-soft); }
.refund-context small, .refund-context b { display: block; }
.refund-context small { color: var(--muted); font-size: 7px; }
.refund-context b { margin-top: 5px; font-size: 9px; }
.modal-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; gap: 8px; padding-top: 5px; }

.toast { position: fixed; right: 28px; bottom: 28px; z-index: 30; min-width: 280px; padding: 13px 16px; display: flex; align-items: center; gap: 11px; border-radius: 17px; background: var(--black); color: white; box-shadow: var(--shadow); transform: translateY(120px); opacity: 0; transition: .25s; }
.toast.show { transform: translateY(0); opacity: 1; }
.toast > span { width: 29px; height: 29px; display: grid; place-items: center; border-radius: 50%; background: var(--green); }
.toast b, .toast small { display: block; }
.toast b { font-size: 9px; }
.toast small { margin-top: 3px; color: #b9bfbb; font-size: 8px; }

/* Finance platform v2 */
.table-wrap { width: 100%; overflow: auto; }
.view-switcher { margin-bottom: 12px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.segmented, .payroll-tabs { display: inline-flex; gap: 4px; padding: 4px; border-radius: 15px; background: #e9eae7; }
.segmented button, .payroll-tabs button { min-height: 34px; padding: 0 13px; border: 0; border-radius: 11px; background: transparent; color: var(--muted); font-size: 8px; font-weight: 600; }
.segmented button.active, .payroll-tabs button.active { background: white; color: var(--black); box-shadow: 0 3px 12px rgba(14,14,14,.08); }
.source-tabs { flex-wrap: wrap; }
.import-button { min-height: 42px; padding: 0 15px; border: 1px dashed #b8bdb9; border-radius: 13px; background: #f8f9f6; color: var(--green-dark); font-size: 9px; font-weight: 700; white-space: nowrap; }
.legend { display: flex; gap: 12px; color: var(--muted); font-size: 8px; }
.legend span { display: flex; align-items: center; gap: 5px; }
.dot { width: 7px; height: 7px; display: inline-block; border-radius: 50%; }
.green-dot { background: var(--green); }
.gray-dot { background: #cfd3d0; }
.black-dot { background: var(--black); }
.amber-dot { background: var(--amber); }
.expense-summary { margin-bottom: 14px; display: grid; grid-template-columns: 1.2fr repeat(3, 1fr); gap: 10px; }
.expense-summary article { min-height: 106px; padding: 17px; border: 1px solid #e4e5e2; border-radius: 20px; background: white; }
.expense-summary article:first-child { background: var(--black); color: white; }
.expense-summary small, .expense-summary strong, .expense-summary span { display: block; }
.expense-summary small { color: var(--muted); font-size: 8px; }
.expense-summary article:first-child small { color: #aeb3af; }
.expense-summary strong { margin-top: 15px; font-size: 17px; }
.expense-summary span { margin-top: 6px; color: var(--muted); font-size: 8px; }
.access-note { color: var(--muted); font-size: 8px; }
.access-note i { width: 7px; height: 7px; margin-right: 4px; display: inline-block; border-radius: 50%; background: var(--green); }
.row-action { width: 30px; height: 30px; border: 0; border-radius: 9px; background: #f0f1ef; color: var(--muted); }
.balance-hero { min-height: 176px; margin-bottom: 15px; padding: 26px 30px; display: flex; align-items: center; justify-content: space-between; border-radius: 28px; background: var(--green); color: white; overflow: hidden; position: relative; }
.balance-hero::after { content: ''; position: absolute; width: 240px; height: 240px; right: -72px; top: -90px; border: 38px solid rgba(255,255,255,.15); border-radius: 50%; }
.balance-hero small, .balance-hero strong, .balance-hero span { display: block; position: relative; z-index: 1; }
.balance-hero small { color: rgba(255,255,255,.72); font-size: 8px; letter-spacing: .1em; }
.balance-hero strong { margin: 17px 0 9px; font-size: 36px; letter-spacing: -.05em; }
.balance-hero span { font-size: 9px; }
.balance-ring { width: 92px; height: 92px; margin-right: 34px; display: grid; place-content: center; border: 10px solid rgba(255,255,255,.22); border-top-color: white; border-radius: 50%; text-align: center; transform: rotate(20deg); position: relative; z-index: 1; }
.balance-ring b, .balance-ring small { transform: rotate(-20deg); }
.balance-ring b { font-size: 15px; }
.balance-ring small { margin-top: 2px; font-size: 6px; }
.balance-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 15px; }
.balance-panel .panel-head > strong { font-size: 14px; }
.balance-line { padding: 12px 18px; display: flex; justify-content: space-between; gap: 14px; border-bottom: 1px solid #eee; font-size: 9px; }
.balance-line:last-child { border-bottom: 0; }
.snapshot-panel { margin-top: 15px; }
.snapshot-chart { height: 190px; padding: 18px 40px; display: flex; align-items: flex-end; justify-content: space-around; gap: 18px; }
.snapshot-chart > div { flex: 1; height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; gap: 7px; }
.snapshot-chart span, .snapshot-chart small { color: var(--muted); font-size: 7px; }
.snapshot-chart i { width: min(56px, 70%); display: block; border-radius: 10px 10px 3px 3px; background: #dfe2df; }
.snapshot-chart i.active { background: var(--green); }
.pnl-layout { display: grid; grid-template-columns: 1.35fr .8fr; gap: 15px; }
.pnl-waterfall { padding: 16px; border: 1px solid #e5e6e3; border-radius: 24px; background: white; }
.pnl-waterfall article { min-height: 64px; padding: 12px 15px; display: grid; grid-template-columns: 1fr auto; align-items: center; border-bottom: 1px solid #efefed; position: relative; overflow: hidden; }
.pnl-waterfall article:last-child { border-bottom: 0; }
.pnl-waterfall article span, .pnl-waterfall article strong { position: relative; z-index: 1; font-size: 10px; }
.pnl-waterfall article i { height: 4px; position: absolute; left: 15px; bottom: 8px; border-radius: 4px; background: #dfe2df; }
.pnl-waterfall article.green i, .pnl-waterfall article.accent i { background: var(--green); }
.pnl-waterfall article.dark { background: var(--black); color: white; border-radius: 14px; }
.pnl-waterfall article.accent { background: var(--green-soft); border-radius: 14px; color: var(--green-dark); }
.donut-wrap { padding: 30px 22px; }
.donut { width: 160px; height: 160px; margin: 0 auto 30px; display: grid; place-items: center; border-radius: 50%; background: conic-gradient(var(--green) 0 47.6%, var(--black) 47.6% 81.3%, var(--amber) 81.3% 92.5%, #d6d9d7 92.5%); position: relative; }
.donut::after { content: ''; position: absolute; inset: 25px; border-radius: 50%; background: white; }
.donut span { position: relative; z-index: 1; text-align: center; }
.donut b, .donut small { display: block; }
.donut b { font-size: 13px; }
.donut small { margin-top: 4px; color: var(--muted); font-size: 7px; }
.donut-legend { display: grid; gap: 12px; }
.donut-legend > div { display: grid; grid-template-columns: 8px 1fr auto; align-items: center; gap: 7px; font-size: 8px; }
.payroll-tabs { margin-bottom: 14px; }
.modal.statement-modal { width: min(820px, 100%); }
.statement-form { padding: 18px 22px 22px; }
.statement-intro { margin-bottom: 16px; padding: 15px; display: flex; align-items: center; gap: 12px; border-radius: 16px; background: var(--green-soft); }
.statement-intro > span { width: 38px; height: 38px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; background: var(--green); color: white; font-size: 17px; }
.statement-intro b, .statement-intro small { display: block; }
.statement-intro b { font-size: 10px; }
.statement-intro small { margin-top: 4px; color: var(--muted); font-size: 8px; line-height: 1.45; }
.statement-settings { margin-bottom: 13px; display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.statement-settings.single { align-items: end; }
.office-note { min-height: 48px; padding: 10px 12px; border: 1px solid #e4e5e2; border-radius: 12px; background: #fafbf9; }
.office-note b, .office-note small { display: block; }
.office-note b { font-size: 8px; }
.office-note small { margin-top: 4px; color: var(--muted); font-size: 7px; line-height: 1.4; }
.drop-zone { min-height: 126px; padding: 22px; display: grid; place-items: center; align-content: center; gap: 6px; border: 1.5px dashed #b8bdb9; border-radius: 18px; background: #fafbf9; text-align: center; cursor: pointer; transition: .18s ease; }
.drop-zone:hover, .drop-zone.drag { border-color: var(--green); background: var(--green-soft); }
.drop-zone.selected { border-style: solid; border-color: var(--green); }
.drop-zone input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.drop-zone b { font-size: 10px; }
.drop-zone small { color: var(--muted); font-size: 8px; }
.drop-icon { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 11px; background: white; color: var(--green-dark); box-shadow: 0 4px 14px rgba(14,14,14,.08); }
.statement-error { margin-top: 12px; padding: 11px 13px; border-radius: 12px; background: var(--danger-soft); color: var(--danger); font-size: 8px; line-height: 1.45; }
.statement-actions { display: flex; margin-top: 15px; }
.statement-actions .primary-button[disabled] { opacity: .55; cursor: wait; }
.import-result { margin-top: 14px; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.import-result > div { padding: 13px; border: 1px solid #e4e5e2; border-radius: 15px; background: white; }
.import-result small, .import-result strong { display: block; }
.import-result small { color: var(--muted); font-size: 7px; }
.import-result strong { margin-top: 8px; font-size: 15px; }
.import-preview-table { max-height: 270px; margin-top: 10px; overflow: auto; border: 1px solid #e4e5e2; border-radius: 15px; }
.import-preview-table .data-table th { position: sticky; top: 0; z-index: 1; }
.import-preview-table p { margin: 0; padding: 10px 14px; color: var(--muted); font-size: 8px; text-align: center; }
.upload-trigger { cursor: pointer; }
.upload-trigger input, .unified-drop input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.source-grid { margin-bottom: 14px; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.source-grid article { min-height: 78px; padding: 14px; display: grid; grid-template-columns: 36px minmax(0,1fr); align-items: center; gap: 10px; border: 1px solid #e4e5e2; border-radius: 18px; background: white; }
.source-grid article > .pill { grid-column: 2; justify-self: start; }
.source-grid b, .source-grid small { display: block; }
.source-grid b { font-size: 9px; }
.source-grid small { margin-top: 4px; color: var(--muted); font-size: 7px; line-height: 1.35; }
.source-logo { width: 36px; height: 36px; display: grid; place-items: center; grid-row: 1 / span 2; border-radius: 11px; font-size: 9px; font-weight: 800; }
.source-logo.green { background: var(--green-soft); color: var(--green-dark); }
.source-logo.black { background: var(--black); color: white; }
.source-logo.blue { background: #e8efff; color: #3159a6; }
.source-logo.gray { background: #eceeec; color: #777d78; }
.unified-drop { min-height: 108px; margin-bottom: 14px; padding: 20px; display: flex; align-items: center; justify-content: center; gap: 13px; border: 1.5px dashed #aeb5b0; border-radius: 20px; background: #fafbf9; cursor: pointer; transition: .18s ease; }
.unified-drop:hover, .unified-drop.drag { border-color: var(--green); background: var(--green-soft); }
.unified-drop > span { width: 42px; height: 42px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 13px; background: white; color: var(--green-dark); box-shadow: 0 5px 16px rgba(14,14,14,.08); font-size: 18px; }
.unified-drop b, .unified-drop small { display: block; }
.unified-drop b { font-size: 10px; }
.unified-drop small { margin-top: 5px; color: var(--muted); font-size: 8px; }
.import-queue { margin-bottom: 14px; }
.import-queue .primary-button[disabled] { opacity: .6; }
.queue-list { padding: 4px 16px 16px; display: grid; gap: 8px; }
.queue-card { min-height: 70px; padding: 11px 13px; display: grid; grid-template-columns: 38px minmax(180px,1fr) auto auto minmax(120px,auto) 28px; align-items: center; gap: 12px; border: 1px solid #e7e8e5; border-radius: 15px; background: #fbfcfa; }
.queue-card.loading { grid-template-columns: 38px 1fr; }
.queue-card.error { grid-template-columns: 38px 1fr auto; border-color: #f1c8c4; background: var(--danger-soft); }
.queue-card > button { width: 28px; height: 28px; border: 0; border-radius: 9px; background: white; color: var(--muted); }
.queue-file { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: var(--green-soft); color: var(--green-dark); font-size: 9px; font-weight: 800; }
.queue-main b, .queue-main small, .queue-card.loading b, .queue-card.loading small, .queue-card.error b, .queue-card.error small { display: block; }
.queue-main b, .queue-card.loading b, .queue-card.error b { overflow: hidden; font-size: 9px; text-overflow: ellipsis; white-space: nowrap; }
.queue-main small, .queue-card.loading small, .queue-card.error small { margin-top: 4px; color: var(--muted); font-size: 7px; }
.queue-stat { display: grid; gap: 3px; white-space: nowrap; }
.queue-stat small { color: var(--muted); font-size: 6px; }
.queue-stat b { font-size: 9px; }
.queue-routes { max-width: 190px; display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 4px; }
.queue-routes span { padding: 4px 6px; border-radius: 7px; background: #eef0ed; color: var(--muted); font-size: 6px; white-space: nowrap; }
.import-layout { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(260px, .65fr); gap: 14px; align-items: start; }
.review-panel { overflow: hidden; }
.review-panel .panel-head > strong { min-width: 26px; height: 26px; display: grid; place-items: center; border-radius: 9px; background: var(--amber-soft); color: var(--amber); font-size: 9px; }
.review-item { min-height: 62px; padding: 10px 14px; display: grid; grid-template-columns: 28px minmax(0,1fr) auto; align-items: center; gap: 9px; border-bottom: 1px solid #eceeeb; }
.review-item:last-child { border-bottom: 0; }
.review-item > span { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 9px; background: var(--amber-soft); color: var(--amber); font-weight: 700; }
.review-item b, .review-item small { display: block; }
.review-item b, .review-item > strong { font-size: 8px; }
.review-item small { margin-top: 4px; overflow: hidden; color: var(--muted); font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.review-empty, .empty-imports { padding: 28px 16px; display: grid; place-items: center; text-align: center; }
.review-empty > span { width: 36px; height: 36px; margin-bottom: 8px; display: grid; place-items: center; border-radius: 50%; background: var(--green-soft); color: var(--green-dark); }
.review-empty b, .review-empty small, .empty-imports b, .empty-imports small { display: block; }
.review-empty b, .empty-imports b { font-size: 9px; }
.review-empty small, .empty-imports small { margin-top: 5px; color: var(--muted); font-size: 7px; line-height: 1.45; }
.expense-table { min-width: 1420px; }
.expense-rule { margin: 12px 0; padding: 11px 14px; display: flex; align-items: center; gap: 12px; border: 1px solid #cfeee3; border-radius: 14px; background: #f2fbf7; color: #285e4d; }
.expense-rule b { flex: 0 0 auto; font-size: 9px; }
.expense-rule span { font-size: 8px; line-height: 1.45; }

.rules-notice { margin-bottom: 16px; padding: 15px 17px; display: flex; gap: 13px; align-items: flex-start; border: 1px solid #cfeee3; border-radius: 18px; background: #f2fbf7; }
.rules-notice > span { width: 36px; height: 36px; display: grid; place-items: center; flex: 0 0 auto; border-radius: 12px; background: #fff; color: var(--green-dark); font-size: 18px; box-shadow: 0 5px 16px rgba(14,14,14,.06); }
.rules-notice b { font-size: 10px; }
.rules-notice p { margin: 5px 0 0; color: #517266; font-size: 8px; line-height: 1.55; }
.rules-tabs { margin-bottom: 14px; display: flex; gap: 8px; }
.rules-tabs button { min-height: 38px; padding: 0 16px; border: 1px solid #d9ddda; border-radius: 12px; background: #fff; color: #555d58; font-size: 9px; font-weight: 700; }
.rules-tabs button.active { border-color: var(--green); background: var(--green-soft); color: var(--green-dark); box-shadow: 0 0 0 3px rgba(12,179,120,.08); }
.rules-panel .panel-head { align-items: center; }
.rules-table { min-width: 920px; }
.rules-table th:nth-child(1) { width: 90px; }
.rules-table th:nth-child(5) { width: 90px; }
.rules-table th:nth-child(6) { width: 110px; }
.rules-empty { min-height: 260px; padding: 40px 22px; display: grid; place-items: center; text-align: center; }
.rules-empty > span { width: 48px; height: 48px; margin-bottom: 11px; display: grid; place-items: center; border-radius: 16px; background: var(--green-soft); color: var(--green-dark); font-size: 20px; }
.rules-empty b { font-size: 13px; }
.rules-empty small { max-width: 560px; margin: 7px 0 16px; color: var(--muted); font-size: 8px; line-height: 1.6; }
.settings-section { margin-bottom: 16px; }
.settings-section > header { margin-bottom: 11px; display: flex; align-items: flex-end; justify-content: space-between; }
.settings-section > header h2 { margin: 0; font-size: 13px; }
.settings-section > header p { margin: 4px 0 0; color: var(--muted); font-size: 8px; }
.integration-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 11px; }
.integration-card { min-height: 132px; padding: 16px; display: grid; grid-template-columns: 44px minmax(0,1fr); gap: 13px; align-items: start; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.integration-card.featured { border-color: #bde8d8; box-shadow: 0 9px 28px rgba(12,179,120,.08); }
.integration-icon { width: 44px; height: 44px; display: grid; place-items: center; border-radius: 14px; background: #f0f2ef; color: #555d58; font-size: 10px; font-weight: 800; }
.integration-icon.amo { background: #e7f8f1; color: var(--green-dark); font-size: 12px; text-transform: lowercase; }
.integration-copy > div { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.integration-copy h3 { margin: 0; font-size: 11px; }
.integration-copy p { margin: 10px 0 5px; color: #4f5652; font-size: 8px; line-height: 1.55; }
.integration-copy small { color: var(--muted); font-size: 7px; }
.system-settings { overflow: hidden; }
.settings-list { display: grid; }
.settings-list > div { min-height: 62px; padding: 12px 16px; display: grid; grid-template-columns: 180px minmax(0,1fr) minmax(220px,.8fr); align-items: center; gap: 16px; border-top: 1px solid var(--line); }
.settings-list span, .settings-list small { color: var(--muted); font-size: 8px; }
.settings-list b { font-size: 9px; }
.inline-expense-control { width: 100%; min-width: 170px; min-height: 34px; padding: 0 10px; border: 1px solid #d8ddd9; border-radius: 10px; background: #fff; color: var(--ink); font: inherit; font-size: 8px; outline: none; }
.inline-expense-control:disabled { border-color: #e4e7e4; background: #f1f3f1; color: #989e9a; cursor: not-allowed; }
.inline-expense-control:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(12,179,120,.11); }
.inline-expense-control:disabled { background: #f4f6f4; color: #9aa29d; cursor: not-allowed; }
.expense-scope-select { min-width: 135px; }
.inline-expense-deal { min-width: 190px; display: grid; gap: 5px; }
.inline-expense-deal small { max-width: 190px; overflow: hidden; color: var(--muted); font-size: 7px; text-overflow: ellipsis; white-space: nowrap; }
.expense-table th:nth-child(3), .expense-table td:nth-child(3) { min-width: 230px; }
.expense-table th:nth-child(6), .expense-table td:nth-child(6) { min-width: 190px; }
.expense-table th:nth-child(7), .expense-table td:nth-child(7) { min-width: 210px; }
.expense-source-preview { padding: 12px 14px; display: grid; grid-template-columns: auto 1fr auto; gap: 5px 10px; align-items: center; border: 1px solid #dfe3df; border-radius: 14px; background: #f8f9f7; }
.expense-source-preview b { font-size: 10px; }
.expense-source-preview small { grid-column: 2 / -1; color: var(--muted); font-size: 8px; }
.expense-source-preview strong { grid-column: 3; grid-row: 1; font-size: 12px; }
.field-help { margin-top: 5px; display: block; color: var(--muted); font-size: 7px; }
.ibt-rate-note { padding: 10px 12px; display: grid; gap: 3px; border-radius: 12px; background: var(--amber-soft); color: #72520f; }
.ibt-rate-note b { font-size: 9px; }
.ibt-rate-note small { font-size: 7px; line-height: 1.4; }
.expense-form [hidden] { display: none !important; }
.refund-flow { margin-bottom: 14px; padding: 13px 16px; display: grid; grid-template-columns: 30px auto 1fr 30px auto 1fr 30px auto; align-items: center; gap: 10px; border: 1px solid #cfeee3; border-radius: 18px; background: #f2fbf7; }
.refund-flow > span { width: 30px; height: 30px; display: grid; place-items: center; border-radius: 10px; background: #fff; color: var(--green-dark); font-size: 9px; font-weight: 800; box-shadow: 0 4px 12px rgba(14,14,14,.05); }
.refund-flow b, .refund-flow small { display: block; }
.refund-flow b { font-size: 9px; }
.refund-flow small { margin-top: 3px; color: #5c786d; font-size: 7px; }
.refund-flow i { height: 1px; background: #b9dfd2; }
.refund-summary { margin-bottom: 14px; display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 10px; }
.refund-summary article { min-height: 100px; padding: 15px; border: 1px solid var(--line); border-radius: 18px; background: #fff; }
.refund-summary article:first-child { background: var(--black); color: #fff; }
.refund-summary small, .refund-summary strong, .refund-summary span { display: block; }
.refund-summary small { color: var(--muted); font-size: 7px; }
.refund-summary strong { margin-top: 15px; font-size: 18px; }
.refund-summary span { margin-top: 6px; color: var(--muted); font-size: 7px; }
.refund-rule { margin-bottom: 14px; padding: 11px 14px; display: flex; gap: 12px; align-items: flex-start; border-radius: 14px; background: #f5f6f4; color: #4d5650; }
.refund-rule b { flex: 0 0 auto; font-size: 9px; }
.refund-rule span { font-size: 8px; line-height: 1.5; }
.refund-table { min-width: 1540px; }
.refund-table th:nth-child(2), .refund-table td:nth-child(2) { min-width: 210px; }
.refund-table th:nth-child(7), .refund-table td:nth-child(7) { min-width: 160px; }
.refund-client { display: grid; justify-items: start; gap: 5px; }
.refund-sale-preview { padding: 11px; display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; border: 1px solid #dfe3df; border-radius: 14px; background: #f8f9f7; }
.refund-sale-preview > div { padding: 8px; border-right: 1px solid #e3e5e2; }
.refund-sale-preview > div:last-child { border-right: 0; }
.refund-sale-preview small, .refund-sale-preview b { display: block; }
.refund-sale-preview small { color: var(--muted); font-size: 6px; }
.refund-sale-preview b { margin-top: 5px; font-size: 9px; }
.integration-card-button { width: 100%; color: inherit; text-align: left; cursor: pointer; font-family: inherit; }
.integration-card-button:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(12,179,120,.12); }
.amo-settings-panel { margin-top: 12px; padding: 18px; border: 1px solid #bde8d8; border-radius: 20px; background: #f7fcfa; }
.amo-settings-panel > header { margin-bottom: 15px; display: flex; align-items: center; justify-content: space-between; gap: 14px; }
.amo-settings-panel h3 { margin: 0; font-size: 12px; }
.amo-settings-panel header p { margin: 5px 0 0; color: var(--muted); font-size: 8px; }
.amo-settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.setting-toggle { min-height: 58px; padding: 10px 12px; display: grid; grid-template-columns: 38px 1fr; align-items: center; gap: 10px; border: 1px solid #dde4df; border-radius: 14px; background: #fff; cursor: pointer; }
.setting-toggle input { position: absolute; opacity: 0; }
.setting-toggle > span { width: 34px; height: 20px; padding: 3px; display: block; border-radius: 20px; background: #d7dcd8; transition: .18s ease; }
.setting-toggle > span::after { content: ''; width: 14px; height: 14px; display: block; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.18); transition: .18s ease; }
.setting-toggle input:checked + span { background: var(--green); }
.setting-toggle input:checked + span::after { transform: translateX(14px); }
.setting-toggle b, .setting-toggle small { display: block; }
.setting-toggle b { font-size: 9px; }
.setting-toggle small { margin-top: 4px; color: var(--muted); font-size: 7px; }
.amo-sync-state { padding: 11px 12px; display: grid; grid-template-columns: 1fr 1fr auto; align-items: center; gap: 12px; border: 1px solid #dde4df; border-radius: 14px; background: #fff; }
.amo-sync-state small, .amo-sync-state b { display: block; }
.amo-sync-state small { color: var(--muted); font-size: 6px; }
.amo-sync-state b { margin-top: 4px; font-size: 9px; }

@media (max-width: 1000px) {
  .expense-summary { grid-template-columns: repeat(2, 1fr); }
  .pnl-layout { grid-template-columns: 1fr; }
  .source-grid { grid-template-columns: repeat(2, 1fr); }
  .import-layout { grid-template-columns: 1fr; }
  .dds-metrics { grid-template-columns: repeat(2,1fr); }
  .sale-layout { grid-template-columns: 1fr; }
  .refund-summary { grid-template-columns: repeat(2,1fr); }
  .refund-flow { grid-template-columns: 30px 1fr; }
  .refund-flow i { display: none; }
  .queue-card { grid-template-columns: 38px minmax(160px,1fr) auto; }
  .queue-stat { grid-column: 2; }
  .queue-routes { grid-column: 2; justify-content: flex-start; max-width: none; }
}

@media (max-width: 1100px) {
  .app-shell { width: 100%; min-height: 100vh; margin: 0; border-radius: 0; grid-template-columns: 200px minmax(0,1fr); }
  .sidebar { min-height: 100vh; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .month-strip { display: none; }
}

@media (max-width: 760px) {
  .app-shell { grid-template-columns: 66px minmax(0,1fr); }
  .sidebar { padding-inline: 10px; }
  .brand > span:last-child, .nav-item span:not(.nav-icon), .nav-item em, .side-section, .user-card > span:not(.avatar), .user-card button { display: none; }
  .brand { justify-content: center; padding-inline: 0; }
  .nav-item { display: grid; grid-template-columns: 1fr; place-items: center; padding: 0; }
  .user-card { display: grid; grid-template-columns: 1fr; place-items: center; padding: 8px; }
  .topbar { padding: 0 14px; }
  .crumb { min-width: 0; }
  .crumb span, .crumb i, .global-search { display: none; }
  .primary-button { margin-left: auto; padding: 0 11px; }
  .period-bar, .page { padding-inline: 14px; }
  .period-status { display: none; }
  .metric-grid, .content-grid, .quick-row, .profile-metrics { grid-template-columns: 1fr; }
  .daily-summary { grid-template-columns: 1fr 1fr; }
  .daily-main { grid-column:1/-1; }
  .panel { overflow-x: auto; }
  .data-table { min-width: 720px; }
  .profile-hero { grid-template-columns: 1fr; }
  .test-banner { align-items: flex-start; flex-direction: column; }
  .profile-actions { align-items: flex-start; }
  .operation-types { grid-template-columns: 1fr 1fr; }
  .modal-form { grid-template-columns: 1fr; }
  .field { grid-column: 1 / -1; }
  .view-switcher { align-items: stretch; flex-direction: column; }
  .segmented { width: 100%; overflow-x: auto; }
  .expense-summary, .balance-grid { grid-template-columns: 1fr; }
  .balance-ring { margin-right: 0; }
  .payroll-tabs { max-width: 100%; overflow-x: auto; }
  .statement-settings, .import-result { grid-template-columns: 1fr; }
  .source-grid { grid-template-columns: 1fr; }
  .integration-grid { grid-template-columns: 1fr; }
  .refund-summary, .refund-sale-preview, .amo-settings-form { grid-template-columns: 1fr; }
  .refund-sale-preview > div { border-right: 0; border-bottom: 1px solid #e3e5e2; }
  .refund-sale-preview > div:last-child { border-bottom: 0; }
  .amo-sync-state { grid-template-columns: 1fr; }
  .allocation-toolbar { grid-template-columns: 1fr; }
  .allocation-picker > header { flex-direction: column; }
  .allocation-candidate { grid-template-columns: minmax(0,1fr) auto; }
  .match-score { grid-column: 1; grid-row: 2; justify-self: start; }
  .candidate-select { grid-column: 2; grid-row: 1 / 3; }
  .payment-plan-summary { grid-template-columns: 1fr; }
  .payment-stage-row { grid-template-columns: 25px 1fr; align-items: start; }
  .payment-stage-row label, .payment-stage-row .row-action { grid-column: 2; }
  .payment-stage-number { grid-row: 1 / 3; }
  .payment-plan-total { align-items: flex-start; flex-direction: column; }
  .settings-list > div { grid-template-columns: 1fr; gap: 5px; }
  .unified-drop { justify-content: flex-start; }
  .queue-card { grid-template-columns: 38px minmax(0,1fr); }
  .queue-stat, .queue-routes { grid-column: 1 / -1; }
}
