/* Панель управления */

#adminApp { min-height: 100vh; background: #F3EEE6; }

/* ---------- Login ---------- */
.admin-login {
  min-height: 100vh;
  display: grid; grid-template-columns: 1.05fr .95fr;
}
.login-art {
  position: relative; overflow: hidden;
  padding: 46px 52px;
  display: flex; flex-direction: column; justify-content: space-between;
  color: var(--cream);
  background: #322A4A;
  isolation: isolate;
}
.login-art::before {
  content: ''; position: absolute; inset: 0; z-index: -2;
  background-image: url('assets/img/fresh.webp');
  background-size: cover; background-position: center;
  filter: saturate(.55) brightness(.62);
  transform: scale(1.03);
}
.login-art::after {
  content: ''; position: absolute; inset: 0; z-index: -1;
  background: linear-gradient(160deg, rgba(50, 42, 74, .64), rgba(50, 42, 74, .9));
}
.login-brand { display: inline-flex; align-items: center; gap: 11px; }
.login-brand .brand-mark { background: rgba(251, 246, 236, .14); color: var(--cream); box-shadow: none; }
.login-brand .brand-name { color: var(--cream); }
.login-brand .brand-city { color: rgba(251, 246, 236, .5); }
.login-quote { max-width: 460px; }
.login-quote .eyebrow { color: rgba(251, 246, 236, .6); }
.login-quote h1 { font-size: clamp(40px, 4.6vw, 62px); line-height: .98; color: var(--cream); margin-bottom: 18px; }
.login-quote p { font-size: 13.5px; line-height: 1.65; color: rgba(251, 246, 236, .62); max-width: 380px; }
.login-foot { display: flex; align-items: center; gap: 16px; font-size: 10.5px; color: rgba(251, 246, 236, .4); }
.login-panel { display: grid; place-items: center; padding: 40px 28px; background: var(--bg); }
.login-card { width: min(390px, 100%); }
.login-card .brand-mark { display: none; }
.login-card h2 { font-size: 40px; margin-bottom: 7px; }
.login-card > p { font-size: 12.5px; color: var(--muted); margin-bottom: 26px; }
.pin-field { position: relative; }
.pin-field input {
  width: 100%; height: 60px; padding: 0 18px;
  border: 1px solid var(--line); border-radius: 14px;
  background: var(--surface); text-align: center;
  font-size: 26px; font-weight: 700; letter-spacing: .42em;
  color: var(--ink);
}
.pin-field input:focus { outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 4px rgba(128, 115, 178, .14); }
.login-error { min-height: 18px; margin: 8px 0 6px; font-size: 11.5px; color: var(--danger); text-align: center; }
.login-card .md-button { width: 100%; height: 50px; }
.login-hint { margin-top: 14px; font-size: 10px; color: var(--muted-2); text-align: center; }
.login-back { display: flex; justify-content: center; margin-top: 22px; }

/* ---------- Shell ---------- */
.admin-shell { min-height: 100vh; }
.admin-rail {
  position: fixed; inset: 0 auto 0 0; z-index: 90;
  width: 246px; padding: 20px 13px 16px;
  display: flex; flex-direction: column;
  background: #2C2442; color: rgba(251, 246, 236, .7);
}
.rail-brand { display: flex; align-items: center; gap: 10px; padding: 5px 10px 26px; }
.rail-brand .brand-mark { background: rgba(251, 246, 236, .1); color: var(--cream); box-shadow: none; width: 35px; height: 35px; border-radius: 11px; }
.rail-brand .brand-name { color: var(--cream); font-size: 23px; }
.rail-brand .brand-city { color: rgba(251, 246, 236, .38); }
.rail-label { padding: 0 12px 8px; font-size: 8.5px; font-weight: 800; letter-spacing: .18em; text-transform: uppercase; color: rgba(251, 246, 236, .28); }
.rail-nav { display: flex; flex-direction: column; gap: 3px; }
.rail-link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 12px; font-weight: 600; text-align: left;
  color: rgba(251, 246, 236, .58);
  transition: background .18s, color .18s;
}
.rail-link .icon { width: 19px; height: 19px; opacity: .8; }
.rail-link:hover { background: rgba(251, 246, 236, .07); color: var(--cream); }
.rail-link.is-active { background: rgba(251, 246, 236, .12); color: var(--cream); }
.rail-link.is-active .icon { opacity: 1; color: #CFC4E9; }
.rail-link .rail-badge {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: #7C6AB0; color: #fff;
  display: grid; place-items: center; font-size: 9px; font-weight: 800;
}
.rail-spacer { flex: 1; }
.rail-card {
  margin: 10px 3px 12px; padding: 13px;
  border: 1px solid rgba(251, 246, 236, .1); border-radius: 12px;
  background: rgba(251, 246, 236, .04);
}
.rail-card span { display: block; font-size: 8px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: rgba(251, 246, 236, .35); }
.rail-card strong { display: block; margin: 3px 0 7px; font-size: 11px; color: rgba(251, 246, 236, .8); line-height: 1.35; }
.rail-card a { font-size: 10px; font-weight: 700; color: #CFC4E9; }
.rail-user { display: flex; align-items: center; gap: 9px; padding: 10px 8px 0; border-top: 1px solid rgba(251, 246, 236, .09); }
.rail-user .avatar { background: rgba(251, 246, 236, .12); color: var(--cream); }
.rail-user-meta { min-width: 0; }
.rail-user-meta strong { display: block; font-size: 10.5px; color: rgba(251, 246, 236, .8); }
.rail-user-meta span { display: block; font-size: 8.5px; color: rgba(251, 246, 236, .35); }
.rail-user button { margin-left: auto; color: rgba(251, 246, 236, .45); }
.rail-user button:hover { color: var(--cream); background: rgba(251, 246, 236, .08); }

.admin-body { margin-left: 246px; min-width: 0; }
.admin-topbar {
  position: sticky; top: 0; z-index: 70;
  height: 74px; padding: 0 28px;
  display: flex; align-items: center; gap: 18px;
  background: rgba(243, 238, 230, .9);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(69, 62, 111, .08);
}
.admin-topbar h1 { font-size: 27px; font-weight: 500; line-height: 1; }
.admin-topbar .top-sub { display: block; margin-top: 3px; font-family: var(--font-body); font-size: 9.5px; color: var(--muted); }
.topbar-search {
  position: relative; margin-left: auto; width: min(310px, 30vw);
}
.topbar-search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); width: 16px; height: 16px; color: var(--muted-2); }
.topbar-search input {
  width: 100%; height: 38px; padding: 0 12px 0 36px;
  border: 1px solid var(--line); border-radius: 10px;
  background: rgba(255, 253, 250, .7); font-size: 11.5px;
}
.topbar-search input:focus { outline: none; background: #fff; border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(128, 115, 178, .1); }
.topbar-actions { display: flex; align-items: center; gap: 5px; }
.topbar-actions .lang-select {
  height: 34px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); font-size: 10px; font-weight: 800; color: var(--ink-2);
}
.topbar-link { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; color: var(--muted); padding: 8px 9px; border-radius: 8px; }
.topbar-link:hover { color: var(--primary); background: var(--primary-mist); }
.admin-avatar { margin-left: 4px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: inline-grid; place-items: center;
  background: var(--primary-soft); color: var(--primary);
  font-size: 10px; font-weight: 800; letter-spacing: .03em;
  flex: none;
}
.avatar-sm { width: 29px; height: 29px; font-size: 9px; }

.admin-view { padding: 26px 28px 80px; max-width: 1500px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 22px; }
.page-head h2 { font-size: 38px; line-height: 1; }
.page-head p { margin-top: 6px; font-size: 11.5px; color: var(--muted); }
.page-actions { display: flex; gap: 7px; flex-wrap: wrap; }

.admin-bottomnav { display: none; }

.demo-banner {
  display: flex; align-items: center; gap: 7px;
  padding: 8px 12px; margin-bottom: 13px;
  border: 1px solid #E7D8B9; border-radius: 9px;
  background: var(--warn-soft); color: var(--warn);
  font-size: 9.5px; font-weight: 600;
}
.demo-banner .icon { width: 14px; height: 14px; }
.demo-banner button { margin-left: auto; font-size: 9px; font-weight: 800; text-decoration: underline; }
.panel-count, .list-count {
  font-size: 9px; font-weight: 700; color: var(--muted);
}
.pending-row {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 9px 0; border-top: 1px solid var(--line);
  text-align: left;
}
.pending-row:first-child { border-top: 0; }
.pending-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--warn); flex: none; }
.pending-meta { flex: 1; min-width: 0; }
.pending-meta strong { display: block; font-size: 10px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pending-meta span { display: block; font-size: 8.5px; color: var(--muted); }
.pending-amount { font-size: 10px; font-weight: 800; color: var(--warn); }
.cal-hint, .fin-hint, .fin-month-label { font-size: 9px; color: var(--muted); }
.modal-sub { display: block; margin-top: 4px; font-size: 9.5px; color: var(--muted); font-weight: 600; letter-spacing: .04em; }

/* ---------- Shared admin ---------- */
.panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: 0 1px 3px rgba(46, 36, 64, .04);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.panel-head h3 { font-family: var(--font-body); font-size: 12px; font-weight: 800; letter-spacing: .01em; }
.panel-head a, .panel-head button { font-size: 10.5px; font-weight: 700; color: var(--primary); }
.panel-body { padding: 20px; }
.panel-pad { padding: 20px; }

.admin-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 38px; padding: 0 14px;
  border-radius: 9px; border: 1px solid transparent;
  font-size: 11px; font-weight: 700;
  transition: all .18s;
  white-space: nowrap;
}
.admin-btn .icon { width: 15px; height: 15px; }
.admin-btn.primary { background: var(--primary); color: #fff; box-shadow: 0 4px 12px rgba(91, 74, 140, .18); }
.admin-btn.primary:hover { background: var(--primary-deep); }
.admin-btn.ghost { border-color: var(--line); background: var(--surface); color: var(--ink-2); }
.admin-btn.ghost:hover { border-color: var(--primary-2); color: var(--primary); background: var(--primary-mist); }
.admin-btn.soft { background: var(--primary-mist); color: var(--primary); }
.admin-btn.soft:hover { background: var(--primary-soft); }
.admin-btn.danger { background: var(--danger-soft); color: var(--danger); }
.admin-btn.danger:hover { background: #F3D7DC; }
.admin-btn.sm { min-height: 31px; padding: 0 10px; font-size: 10px; border-radius: 7px; }
.admin-btn:disabled { opacity: .5; pointer-events: none; }

.admin-icon-btn {
  width: 30px; height: 30px; border-radius: 7px;
  display: inline-grid; place-items: center; color: var(--muted);
  transition: all .18s;
}
.admin-icon-btn:hover { background: var(--primary-mist); color: var(--primary); }
.admin-icon-btn .icon { width: 16px; height: 16px; }
.admin-icon-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }

.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.kpi-card {
  position: relative; overflow: hidden;
  padding: 17px 18px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 15px;
}
.kpi-card::after {
  content: ''; position: absolute; right: -20px; top: -25px;
  width: 90px; height: 90px; border-radius: 50%;
  background: var(--primary-mist); opacity: .7;
}
.kpi-top { position: relative; z-index: 1; display: flex; align-items: center; justify-content: space-between; }
.kpi-label { font-size: 9px; font-weight: 800; letter-spacing: .9px; text-transform: uppercase; color: var(--muted); }
.kpi-icon { width: 29px; height: 29px; border-radius: 9px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; }
.kpi-icon .icon { width: 15px; height: 15px; }
.kpi-value { position: relative; z-index: 1; margin-top: 9px; font-family: var(--font-display); font-size: 34px; line-height: 1; font-weight: 600; color: var(--ink); }
.kpi-sub { position: relative; z-index: 1; margin-top: 5px; font-size: 9.5px; color: var(--muted); }
.kpi-sub strong { color: var(--sage-deep); }

.dash-grid { display: grid; grid-template-columns: 1.55fr .95fr; gap: 14px; margin-bottom: 14px; }
.dash-grid-secondary { grid-template-columns: 1.55fr .95fr; }
.chart-panel .panel-body { padding: 15px 20px 18px; }
.chart-legend { display: flex; gap: 14px; font-size: 9.5px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 5px; }
.legend-dot { width: 8px; height: 8px; border-radius: 2px; background: var(--primary); }
.legend-dot.soft { background: #C8BEE0; }
.bar-chart { display: flex; align-items: flex-end; gap: 10px; height: 180px; padding-top: 10px; border-bottom: 1px solid var(--line); }
.bar-group { flex: 1; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 0; min-width: 0; }
.bar-stack { width: 100%; height: 100%; display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.bar { width: min(17px, 42%); border-radius: 4px 4px 1px 1px; background: var(--primary); min-height: 2px; transition: height .4s; }
.bar.soft { background: #C8BEE0; }
.bar-labels { display: flex; gap: 10px; padding-top: 8px; }
.bar-label { flex: 1; text-align: center; font-size: 8.5px; font-weight: 700; color: var(--muted-2); text-transform: uppercase; letter-spacing: .04em; }

.upcoming-list { display: flex; flex-direction: column; }
.upcoming-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.upcoming-item:first-child { border-top: 0; }
.date-box {
  width: 39px; height: 43px; flex: none; border-radius: 9px;
  background: var(--bg-soft); border: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  line-height: 1;
}
.date-box strong { font-size: 14px; font-weight: 800; color: var(--ink); }
.date-box span { font-size: 7.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 2px; }
.upcoming-meta { min-width: 0; flex: 1; }
.upcoming-meta strong { display: block; font-size: 10.5px; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upcoming-meta span { display: block; font-size: 9px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.upcoming-amount { font-size: 10.5px; font-weight: 800; color: var(--ink); }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 10.5px; }
.data-table th {
  text-align: left; padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 8px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted-2);
  white-space: nowrap;
}
.data-table td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr { cursor: pointer; transition: background .15s; }
.data-table tbody tr:hover { background: var(--primary-mist); }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table .ref { font-size: 9.5px; font-weight: 800; color: var(--primary); letter-spacing: .03em; white-space: nowrap; }
.cell-main { display: flex; align-items: center; gap: 8px; }
.cell-main strong { display: block; font-size: 10.5px; font-weight: 700; color: var(--ink); }
.cell-main span { display: block; font-size: 8.5px; color: var(--muted); }
.cell-sub { display: block; font-size: 8.5px; color: var(--muted); margin-top: 2px; }
.cell-amount { font-weight: 800; white-space: nowrap; color: var(--ink); }
.cell-actions { display: flex; gap: 2px; justify-content: flex-end; }
.row-arrow { color: var(--muted-2); }

.status-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 8px; border-radius: 999px;
  font-size: 8.5px; font-weight: 800; white-space: nowrap;
}
.status-chip .dot { width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.status-new { background: var(--primary-soft); color: var(--primary); }
.status-waiting { background: var(--warn-soft); color: var(--warn); }
.status-confirmed { background: var(--ok-soft); color: var(--ok); }
.status-not_ordered { background: #EEEBE6; color: #7D7468; }
.status-cancelled { background: var(--danger-soft); color: var(--danger); }
.status-spam { background: #ECE9EE; color: #7A7080; }
.pay-chip {
  display: inline-flex; padding: 3px 7px; border-radius: 5px;
  font-size: 8px; font-weight: 800; white-space: nowrap;
  background: var(--bg-soft); color: var(--muted);
  border: 1px solid var(--line);
}
.pay-paid { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.pay-deposit { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.pay-unpaid { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.pay-refunded { background: #ECE9EE; color: #7A7080; border-color: transparent; }

.filter-bar { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; margin-bottom: 13px; }
.filter-chip {
  display: inline-flex; align-items: center; gap: 5px;
  min-height: 31px; padding: 0 11px;
  border-radius: 999px; border: 1px solid var(--line);
  background: var(--surface); color: var(--muted);
  font-size: 9.5px; font-weight: 700;
  transition: all .18s;
}
.filter-chip:hover { border-color: var(--primary-2); color: var(--primary); }
.filter-chip.is-active { background: var(--ink); border-color: var(--ink); color: var(--cream); }
.filter-chip .count {
  min-width: 16px; height: 16px; padding: 0 4px; border-radius: 5px;
  background: var(--bg-soft); color: var(--muted);
  display: inline-grid; place-items: center; font-size: 8px;
}
.filter-chip.is-active .count { background: rgba(251, 246, 236, .18); color: var(--cream); }
.list-toolbar { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; margin-bottom: 14px; }
.list-search { position: relative; flex: 1; min-width: 180px; max-width: 330px; }
.list-search .icon { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--muted-2); }
.list-search input {
  width: 100%; height: 35px; padding: 0 11px 0 32px;
  border: 1px solid var(--line); border-radius: 8px; background: var(--surface);
  font-size: 10.5px;
}
.list-search input:focus { outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(128, 115, 178, .1); }

.empty-state { padding: 52px 20px; text-align: center; color: var(--muted); }
.empty-state .icon { width: 42px; height: 42px; margin: 0 auto 12px; color: var(--line-strong); }
.empty-state h3 { font-family: var(--font-body); font-size: 12px; font-weight: 800; color: var(--ink-2); margin-bottom: 3px; }
.empty-state p { font-size: 10.5px; }

/* ---------- Sheet ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; z-index: 190;
  background: rgba(46, 36, 64, .38); backdrop-filter: blur(3px);
  display: flex; justify-content: flex-end;
  animation: fadeIn .18s;
}
.sheet {
  width: min(590px, 100%); height: 100%;
  background: var(--surface); box-shadow: -20px 0 60px rgba(46, 36, 64, .18);
  display: flex; flex-direction: column;
  animation: sheetIn .3s var(--ease);
}
@keyframes sheetIn { from { transform: translateX(100%); } }
.sheet-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 16px;
  padding: 20px 22px 17px; border-bottom: 1px solid var(--line);
  background: var(--surface); position: sticky; top: 0; z-index: 2;
}
.sheet-head h2 { font-size: 27px; line-height: 1; }
.sheet-head .sheet-sub { margin-top: 5px; display: flex; align-items: center; gap: 7px; font-size: 9.5px; color: var(--muted); flex-wrap: wrap; }
.sheet-head-actions { display: flex; align-items: center; gap: 2px; }
.sheet-body { flex: 1; overflow-y: auto; padding: 20px 22px 24px; }
.sheet-foot {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  padding: 13px 22px; border-top: 1px solid var(--line);
  background: var(--bg-soft);
}
.sheet-foot .spacer { flex: 1; }
.sheet-section { margin-bottom: 20px; }
.sheet-section:last-child { margin-bottom: 0; }
.sheet-section-title {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-bottom: 9px;
  font-size: 8.5px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--muted-2);
}
.sheet-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.sheet-grid .full { grid-column: span 2; }
.admin-field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.admin-field > label { font-size: 8.5px; font-weight: 800; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.admin-field input, .admin-field select, .admin-field textarea {
  width: 100%; min-height: 36px; padding: 8px 10px;
  border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); font-size: 10.5px; color: var(--ink);
}
.admin-field textarea { min-height: 70px; resize: vertical; line-height: 1.5; }
.admin-field select { padding-right: 26px; }
.admin-field input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--primary); }
.admin-field input:focus, .admin-field select:focus, .admin-field textarea:focus {
  outline: none; border-color: var(--primary-2); box-shadow: 0 0 0 3px rgba(128, 115, 178, .1);
}
.admin-field input:disabled { background: var(--bg-soft); color: var(--muted); }
.admin-field .hint { font-size: 8.5px; color: var(--muted-2); }
.admin-field.inline { flex-direction: row; align-items: center; justify-content: space-between; gap: 10px; }
.admin-field.inline label { text-transform: none; letter-spacing: 0; font-size: 10.5px; }

.quote-box { padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-soft); }
.quote-row { display: flex; justify-content: space-between; gap: 10px; font-size: 10px; padding: 3px 0; color: var(--muted); }
.quote-row span:last-child { color: var(--ink-2); font-weight: 600; }
.quote-row.total { margin-top: 4px; padding-top: 7px; border-top: 1px solid var(--line-strong); font-size: 12px; color: var(--ink); font-weight: 800; }
.quote-row.total span:last-child { font-family: var(--font-display); font-size: 21px; color: var(--primary-deep); }
.quote-row.discount span:last-child { color: var(--danger); }
.admin-extras { display: flex; flex-direction: column; gap: 4px; }
.admin-extra-row {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px;
}
.admin-extra-row.is-active { background: var(--primary-mist); border-color: rgba(91, 74, 140, .3); }
.admin-extra-row input[type=checkbox] { width: 14px; height: 14px; accent-color: var(--primary); }
.admin-extra-name { flex: 1; font-size: 9.5px; font-weight: 600; color: var(--ink-2); }
.admin-extra-row select, .admin-extra-row input[type=number] {
  width: 64px; height: 27px; border: 1px solid var(--line); border-radius: 6px;
  font-size: 9px; padding: 0 7px; background: var(--surface);
}
.admin-extra-row select { width: 98px; }
.admin-extra-row .price { font-size: 9px; font-weight: 800; min-width: 40px; text-align: right; }

.history-list { display: flex; flex-direction: column; gap: 0; }
.history-item { display: flex; gap: 9px; padding: 7px 0; font-size: 9px; color: var(--muted); border-top: 1px dashed var(--line); }
.history-item:first-child { border-top: 0; }
.history-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--primary-2); margin-top: 4px; flex: none; }
.history-item strong { color: var(--ink-2); font-weight: 700; }
.history-time { margin-left: auto; font-size: 8px; color: var(--muted-2); white-space: nowrap; }

/* ---------- Calendar ---------- */
.cal-toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 13px; flex-wrap: wrap; }
.cal-month { display: flex; align-items: center; gap: 4px; }
.cal-month h3 { font-family: var(--font-display); font-size: 26px; font-weight: 500; min-width: 190px; text-align: center; }
.cal-month h3::first-letter { text-transform: uppercase; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); border: 1px solid var(--line); border-radius: 13px; overflow: hidden; background: var(--line); gap: 1px; }
.cal-head { background: var(--bg-soft); padding: 8px; text-align: center; font-size: 8px; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; color: var(--muted-2); }
.cal-cell { background: var(--surface); min-height: 108px; padding: 7px; position: relative; }
.cal-cell.is-out { background: #FAF7F1; }
.cal-cell.is-today { background: var(--primary-mist); }
.cal-cell.is-today .cal-date { background: var(--primary); color: #fff; }
.cal-date { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; font-size: 9px; font-weight: 800; color: var(--ink-2); }
.cal-cell.is-out .cal-date { color: var(--muted-2); }
.cal-events { display: flex; flex-direction: column; gap: 3px; margin-top: 4px; }
.cal-event {
  display: flex; align-items: center; gap: 4px; width: 100%;
  padding: 3px 5px; border-radius: 4px;
  font-size: 7.5px; font-weight: 700; line-height: 1.25;
  text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  background: var(--primary-soft); color: var(--primary);
}
.cal-event.time { color: var(--muted); font-weight: 600; }
.cal-event.status-confirmed { background: var(--ok-soft); color: var(--ok); }
.cal-event.status-waiting { background: var(--warn-soft); color: var(--warn); }
.cal-event.status-new { background: var(--primary-soft); color: var(--primary); }
.cal-event.status-cancelled, .cal-event.status-spam { background: #ECE9EE; color: #7A7080; text-decoration: line-through; }
.cal-more { font-size: 7.5px; font-weight: 700; color: var(--muted); padding-left: 3px; }
.cal-add {
  position: absolute; right: 5px; top: 5px;
  width: 18px; height: 18px; border-radius: 5px;
  display: grid; place-items: center; color: var(--muted-2);
  opacity: 0; transition: opacity .15s;
}
.cal-cell:hover .cal-add { opacity: 1; }
.cal-add:hover { background: var(--primary-soft); color: var(--primary); }
.cal-add .icon { width: 11px; height: 11px; }
.cal-legend { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 13px; font-size: 9px; color: var(--muted); }
.cal-legend span { display: inline-flex; align-items: center; gap: 5px; }
.cal-legend i { width: 8px; height: 8px; border-radius: 2px; }
.cal-mobile-list { display: none; }

/* ---------- Finance ---------- */
.fin-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 14px; }
.fin-card { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; }
.fin-card span { font-size: 8.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.fin-card strong { display: block; margin-top: 6px; font-family: var(--font-display); font-size: 31px; line-height: 1; font-weight: 600; color: var(--ink); }
.fin-card small { display: block; margin-top: 4px; font-size: 8.5px; color: var(--muted); }
.fin-layout { display: grid; grid-template-columns: 1fr; gap: 14px; }
.fin-chart { display: flex; align-items: flex-end; gap: 14px; height: 160px; padding-top: 8px; border-bottom: 1px solid var(--line); }
.recon-flag { display: inline-flex; align-items: center; gap: 4px; padding: 3px 7px; border-radius: 5px; font-size: 8px; font-weight: 800; }
.recon-ok { background: var(--ok-soft); color: var(--ok); }
.recon-mismatch { background: var(--danger-soft); color: var(--danger); }
.recon-unmarked { background: var(--warn-soft); color: var(--warn); }
.recon-pending { background: #ECE9EE; color: #7A7080; }
.fin-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 12px; }
.fin-toolbar input[type=month] {
  height: 34px; padding: 0 9px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); font-size: 10px; font-weight: 700;
}

/* ---------- Settings ---------- */
.settings-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; align-items: start; }
.settings-card { background: var(--surface); border: 1px solid var(--line); border-radius: 15px; padding: 19px; }
.settings-card.full { grid-column: span 2; }
.settings-card h3 { font-size: 22px; margin-bottom: 2px; }
.settings-card > p { font-size: 10px; color: var(--muted); margin-bottom: 13px; }
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.settings-grid .full { grid-column: span 2; }
.settings-grid.three { grid-template-columns: repeat(3, 1fr); }
.settings-card .admin-btn { margin-top: 13px; }
.settings-savebar {
  position: sticky; top: 74px; z-index: 30;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 13px; margin-bottom: 13px;
  background: rgba(255, 253, 250, .9); border: 1px solid var(--line);
  border-radius: 11px; backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(46, 36, 64, .05);
}
.settings-savebar span { font-size: 9.5px; color: var(--muted); }
.settings-savebar .spacer { flex: 1; }
.publish-list { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.publish-item { display: block; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg-soft); transition: border-color .18s, background .18s; }
.publish-item:hover { border-color: var(--primary-2); background: var(--primary-mist); }
.publish-item strong { display: flex; align-items: center; gap: 6px; font-size: 9.5px; color: var(--ink); }
.publish-item strong .icon:last-child { margin-left: auto; color: var(--muted-2); }
.publish-item span { display: block; margin-top: 3px; font-size: 8.5px; line-height: 1.4; color: var(--muted); }
.publish-item .icon { width: 13px; height: 13px; color: var(--sage-deep); }
.data-actions { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.integration-test { display: flex; gap: 7px; align-items: center; margin-top: 11px; }
.integration-test span { font-size: 9px; color: var(--muted); }
.pin-form { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 7px; }

/* ---------- Invoice editor ---------- */
.invoice-editor .modal-body { max-height: 65vh; overflow-y: auto; }
.inv-lines { width: 100%; border-collapse: collapse; }
.inv-lines th { font-size: 8px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); text-align: left; padding: 6px 4px; border-bottom: 1px solid var(--line); }
.inv-lines td { padding: 4px; vertical-align: middle; }
.inv-lines input, .inv-lines select {
  width: 100%; height: 30px; padding: 0 7px;
  border: 1px solid var(--line); border-radius: 6px; font-size: 9.5px; background: var(--surface);
}
.inv-lines input.desc { min-width: 160px; }
.inv-lines td.num { width: 70px; }
.inv-lines td.total { width: 75px; text-align: right; font-size: 9.5px; font-weight: 800; }
.inv-lines .del { width: 26px; }
.inv-summary { margin-left: auto; width: 260px; margin-top: 13px; }
.inv-summary .quote-row { font-size: 10.5px; }
.inv-total { display: flex; justify-content: space-between; padding-top: 7px; border-top: 1px solid var(--line-strong); margin-top: 4px; font-size: 12px; font-weight: 800; }
.inv-total strong { font-family: var(--font-display); font-size: 23px; color: var(--primary-deep); }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .fin-grid { grid-template-columns: 1fr 1fr; }
  .dash-grid, .dash-grid-secondary { grid-template-columns: 1fr; }
  .settings-form { grid-template-columns: 1fr; }
  .settings-card.full { grid-column: span 1; }
}
@media (max-width: 980px) {
  .admin-rail { width: 72px; padding: 18px 9px; }
  .rail-brand { justify-content: center; padding-inline: 0; }
  .rail-brand .brand-text, .rail-label, .rail-link span, .rail-link .rail-badge, .rail-card, .rail-user-meta, .rail-user button { display: none; }
  .rail-link { justify-content: center; padding: 11px; }
  .rail-link .icon { width: 21px; height: 21px; }
  .rail-user { justify-content: center; }
  .admin-body { margin-left: 72px; }
  .admin-topbar { padding: 0 20px; }
  .topbar-search { width: min(260px, 32vw); }
  .topbar-link span { display: none; }
  .admin-view { padding: 20px 20px 80px; }
  .login-art { padding: 34px; }
}
@media (max-width: 760px) {
  .admin-login { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .login-panel { min-height: 100vh; }
  .admin-rail { display: none; }
  .admin-body { margin-left: 0; }
  .admin-topbar { height: 62px; padding: 0 14px; gap: 10px; }
  .admin-topbar h1 { font-size: 21px; }
  .admin-topbar .top-sub { display: none; }
  .topbar-search { display: none; }
  .topbar-link { display: none; }
  .admin-view { padding: 16px 13px 92px; }
  .admin-bottomnav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 80;
    display: flex; align-items: stretch; justify-content: space-around;
    height: 62px; padding-bottom: env(safe-area-inset-bottom);
    background: rgba(255, 253, 250, .96); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line);
  }
  .bottom-link {
    flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
    color: var(--muted); font-size: 7.5px; font-weight: 700;
  }
  .bottom-link .icon { width: 20px; height: 20px; }
  .bottom-link.is-active { color: var(--primary); }
  .page-head { flex-direction: column; align-items: flex-start; gap: 11px; margin-bottom: 16px; }
  .page-head h2 { font-size: 31px; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .kpi-card { padding: 13px; }
  .kpi-value { font-size: 27px; }
  .fin-grid { grid-template-columns: 1fr 1fr; }
  .sheet { width: 100%; }
  .sheet-grid { grid-template-columns: 1fr; }
  .sheet-grid .full { grid-column: span 1; }
  .settings-grid, .settings-grid.three { grid-template-columns: 1fr; }
  .settings-grid .full { grid-column: span 1; }
  .publish-list { grid-template-columns: 1fr; }
  .cal-grid { display: none; }
  .cal-mobile-list { display: flex; flex-direction: column; gap: 7px; }
  .cal-mobile-day { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); }
  .cal-mobile-date { padding: 8px 11px; background: var(--bg-soft); font-size: 9px; font-weight: 800; color: var(--muted); }
  .cal-mobile-event { display: flex; align-items: center; gap: 8px; padding: 9px 11px; border-top: 1px solid var(--line); font-size: 10px; width: 100%; text-align: left; }
  .cal-mobile-event .time { font-weight: 800; color: var(--primary); width: 36px; }
  .cal-mobile-event .name { flex: 1; font-weight: 600; }
  .data-table th:nth-child(3), .data-table td:nth-child(3) { display: none; }
  .data-table th:nth-child(4), .data-table td:nth-child(4) { display: none; }
  .data-table th:nth-child(7), .data-table td:nth-child(7) { display: none; }
  .data-table th:nth-child(8), .data-table td:nth-child(8) { display: none; }
  .fin-table { min-width: 620px; }
  .fin-table th:nth-child(3), .fin-table td:nth-child(3),
  .fin-table th:nth-child(4), .fin-table td:nth-child(4) { display: table-cell; }
  .fin-chart { gap: 8px; }
  .inv-lines .desc { min-width: 110px; }
  .inv-summary { width: 100%; }
}
@media (max-width: 480px) {
  .kpi-grid, .fin-grid { grid-template-columns: 1fr 1fr; }
  .filter-chip { font-size: 8.5px; padding-inline: 9px; }
}
