:root {
  --ink: #18221f;
  --ink-soft: #53615b;
  --muted: #79857f;
  --line: #e5e9e5;
  --surface: #ffffff;
  --canvas: #f4f6f3;
  --sidebar: #17231f;
  --sidebar-muted: #9eaaa3;
  --accent: #b89a61;
  --accent-soft: #f5efe2;
  --good: #1f785a;
  --good-bg: #eaf5ef;
  --warn: #8f5b19;
  --warn-bg: #fff4dc;
  --bad: #b33a3a;
  --bad-bg: #fdeeee;
  --radius: 13px;
  --shadow: 0 8px 26px rgba(20, 38, 29, .045);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { opacity: .55; cursor: not-allowed; }
a { color: inherit; }
.boot-screen { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 15px; color: var(--muted); font-size: 13px; }
.brand-mark { display: grid; place-items: center; height: 49px; width: 63px; color: #ecd6a6; font-size: 19px; font-weight: 800; letter-spacing: -.07em; border: 1px solid rgba(215,189,130,.45); border-radius: 10px; background: var(--sidebar); }
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1fr) minmax(360px, 480px); background: #f5f6f3; }
.login-art { padding: clamp(28px, 6vw, 86px); display: flex; flex-direction: column; justify-content: space-between; background: var(--sidebar); color: #edf0eb; min-height: 100vh; position: relative; overflow: hidden; }
.login-art:after { content: ""; position: absolute; width: 560px; height: 560px; border: 1px solid rgba(215,189,130,.15); border-radius: 50%; right: -230px; bottom: -220px; box-shadow: 0 0 0 65px rgba(215,189,130,.025), 0 0 0 130px rgba(215,189,130,.018); }
.login-title { max-width: 530px; margin: auto 0; position: relative; z-index: 1; }
.login-title .eyebrow { color: #d8c28e; margin-bottom: 25px; }
.login-title h1 { font-family: Georgia, "Times New Roman", serif; font-weight: 400; font-size: clamp(36px, 5.5vw, 67px); letter-spacing: -.04em; line-height: 1.05; margin: 0 0 24px; }
.login-title p { color: #aeb9b1; font-size: 15px; line-height: 1.85; max-width: 430px; }
.login-foot { color: #78877e; font-size: 11px; letter-spacing: .07em; text-transform: uppercase; position: relative; z-index: 1; }
.login-side { display: flex; align-items: center; justify-content: center; padding: 32px; }
.login-card { background: #fff; border: 1px solid var(--line); box-shadow: var(--shadow); border-radius: 17px; padding: clamp(25px, 4vw, 42px); width: 100%; max-width: 410px; }
.login-card h2 { margin: 0 0 9px; font-size: 25px; letter-spacing: -.035em; }
.login-card .sub { margin: 0 0 27px; color: var(--muted); font-size: 13px; line-height: 1.6; }
.form-stack { display: grid; gap: 16px; }
.field { display: grid; gap: 7px; min-width: 0; }
.field label, .field-label { color: #46554d; font-size: 12px; font-weight: 650; }
.field input, .field select, .field textarea, .search-input, .control { width: 100%; min-width: 0; border: 1px solid #dce2dd; background: #fff; color: var(--ink); border-radius: 8px; padding: 10px 11px; outline: none; font-size: 13px; }
.field input:focus, .field select:focus, .field textarea:focus, .search-input:focus, .control:focus { border-color: #a99364; box-shadow: 0 0 0 3px rgba(184,154,97,.12); }
.field textarea { min-height: 78px; resize: vertical; }
.field .help { color: var(--muted); font-size: 11px; line-height: 1.45; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; border: 1px solid transparent; border-radius: 8px; padding: 10px 13px; font-weight: 650; font-size: 12px; transition: background .15s ease, border-color .15s ease, transform .15s ease; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn-primary { color: #fff; background: var(--ink); }
.btn-primary:hover { background: #2d4238; }
.btn-accent { color: #2c281e; background: #dfcca2; border-color: #d2bd8e; }
.btn-accent:hover { background: #d4bd8a; }
.btn-secondary { color: #35443c; background: white; border-color: #d9e0da; }
.btn-secondary:hover { background: #f8faf7; border-color: #bcc8bf; }
.btn-danger { color: var(--bad); background: #fff; border-color: #f1cccc; }
.btn-small { padding: 7px 9px; font-size: 11px; }
.btn-icon { padding: 8px 10px; min-width: 35px; }
.form-error { color: var(--bad); background: var(--bad-bg); border-radius: 8px; font-size: 12px; line-height: 1.5; padding: 10px 12px; }
.hidden { display: none !important; }
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 246px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 21px 14px 17px; background: var(--sidebar); color: #f0f3ee; display: flex; flex-direction: column; overflow-y: auto; z-index: 30; }
.brand { display: flex; gap: 12px; align-items: center; padding: 1px 10px 23px; border-bottom: 1px solid rgba(255,255,255,.09); }
.brand .brand-mark { width: 45px; height: 42px; font-size: 16px; flex: 0 0 auto; }
.brand-name { font-size: 14px; font-weight: 720; letter-spacing: -.015em; }
.brand-sub { color: #96a49b; font-size: 10px; margin-top: 4px; letter-spacing: .11em; text-transform: uppercase; }
.nav-section { color: #718177; font-size: 9px; font-weight: 750; letter-spacing: .14em; padding: 22px 12px 8px; text-transform: uppercase; }
.nav-list { display: grid; gap: 3px; }
.nav-button { width: 100%; display: flex; align-items: center; gap: 11px; border: 1px solid transparent; text-align: left; background: transparent; color: var(--sidebar-muted); border-radius: 8px; padding: 10px 11px; font-size: 12px; font-weight: 550; }
.nav-button:hover { background: rgba(255,255,255,.05); color: #f7f8f6; }
.nav-button.active { background: rgba(222,202,157,.13); color: #e4d0a3; border-color: rgba(222,202,157,.13); }
.nav-icon { width: 17px; height: 17px; border: 1px solid currentColor; display: grid; place-items: center; border-radius: 5px; font-size: 9px; opacity: .9; flex: 0 0 auto; }
.sidebar-bottom { margin-top: auto; padding-top: 20px; }
.connection-mini { display: flex; align-items: center; gap: 8px; padding: 11px 11px 15px; color: #96a49b; font-size: 11px; line-height: 1.4; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; display: inline-block; background: #d0a65b; flex: 0 0 auto; }
.status-dot.good { background: #6fcca1; }
.status-dot.bad { background: #df7979; }
.logout-btn { margin: 0 4px; width: calc(100% - 8px); display: flex; justify-content: flex-start; }
.main-wrap { min-width: 0; }
.topbar { min-height: 70px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 14px 30px; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.92); position: sticky; top: 0; z-index: 20; backdrop-filter: blur(14px); }
.topbar-left { display: flex; align-items: center; gap: 12px; min-width: 0; }
.menu-toggle { display: none; }
.breadcrumb { font-size: 11px; color: var(--muted); margin-bottom: 4px; }
.topbar h1 { margin: 0; font-size: 20px; letter-spacing: -.035em; font-weight: 690; }
.topbar-right { display: flex; align-items: center; gap: 11px; }
.top-date { color: var(--muted); font-size: 11px; white-space: nowrap; }
.user-chip { border: 1px solid var(--line); padding: 7px 10px; border-radius: 30px; display: flex; align-items: center; gap: 8px; color: #53615b; font-size: 11px; white-space: nowrap; }
.user-initial { background: var(--accent-soft); color: #7d6431; border-radius: 50%; width: 25px; height: 25px; display: grid; place-items: center; font-weight: 750; }
.page-content { padding: 27px 30px 48px; max-width: 1650px; margin: 0 auto; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.page-head h2 { margin: 0 0 7px; font-size: 19px; letter-spacing: -.035em; }
.page-head p { margin: 0; max-width: 700px; color: var(--muted); line-height: 1.65; font-size: 12px; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 14px; margin-bottom: 20px; }
.metric-card { position: relative; overflow: hidden; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 19px; box-shadow: var(--shadow); min-width: 0; }
.metric-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.metric-label { color: var(--muted); font-size: 11px; font-weight: 600; }
.metric-symbol { height: 29px; width: 29px; display: grid; place-items: center; border-radius: 8px; background: #f2f4f0; color: #69756d; font-size: 12px; }
.metric-value { margin-top: 17px; display: block; font-weight: 720; font-size: clamp(21px, 2.1vw, 29px); line-height: 1.15; letter-spacing: -.045em; overflow-wrap: anywhere; }
.metric-foot { color: var(--muted); font-size: 10px; margin-top: 8px; line-height: 1.45; }
.content-grid { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(260px, .8fr); gap: 17px; align-items: start; }
.panel { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 17px; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 15px; }
.panel-head h3 { font-size: 13px; margin: 0; font-weight: 700; }
.panel-head .subtle { color: var(--muted); font-size: 10px; }
.inline-link { border: 0; background: transparent; color: #8a713f; font-size: 11px; font-weight: 700; padding: 4px; }
.notice { display: flex; gap: 11px; align-items: flex-start; padding: 13px 14px; margin-bottom: 18px; border: 1px solid #eadbb8; background: #fcf8ed; border-radius: 10px; color: #6d5830; font-size: 12px; line-height: 1.6; }
.notice strong { color: #594620; }
.notice.neutral { background: #f7f9f7; border-color: #e5e9e5; color: #647069; }
.notice.danger { background: #fff4f2; border-color: #f2d6d1; color: #8c4a40; }
.table-wrap { width: 100%; overflow-x: auto; border: 1px solid #edf0ed; border-radius: 9px; }
table { width: 100%; border-collapse: collapse; font-size: 11px; white-space: nowrap; }
th { font-size: 10px; color: #7a867f; font-weight: 680; text-align: left; background: #f8f9f7; padding: 11px 12px; border-bottom: 1px solid var(--line); }
td { padding: 12px; color: #3e4c44; border-bottom: 1px solid #edf0ed; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfa; }
.cell-primary { color: #202c26; font-weight: 670; }
.cell-muted { color: var(--muted); font-size: 10px; margin-top: 4px; }
.amount { font-variant-numeric: tabular-nums; font-weight: 660; text-align: right; }
.text-right { text-align: right; }
.status { display: inline-flex; align-items: center; gap: 5px; padding: 5px 8px; border-radius: 20px; color: #69756e; background: #f0f2ef; font-size: 9px; font-weight: 750; letter-spacing: .03em; text-transform: uppercase; }
.status.good { color: var(--good); background: var(--good-bg); }
.status.warn { color: var(--warn); background: var(--warn-bg); }
.status.bad { color: var(--bad); background: var(--bad-bg); }
.status.info { color: #405c7e; background: #edf3fa; }
.table-actions { display: flex; align-items: center; gap: 5px; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.search-input { width: min(280px, 100%); min-height: 36px; }
.mini-select { min-height: 36px; border: 1px solid #dce2dd; background: white; padding: 8px 10px; border-radius: 8px; font-size: 11px; color: #45534b; }
.empty { padding: 35px 20px; text-align: center; color: var(--muted); font-size: 12px; line-height: 1.7; }
.empty strong { color: #4a5b50; display: block; margin-bottom: 5px; }
.two-col-form { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 15px; }
.three-col-form { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 14px; }
.form-section-title { margin: 0 0 15px; font-size: 12px; color: #48574e; font-weight: 740; }
.form-footer { margin-top: 19px; display: flex; justify-content: flex-end; gap: 8px; align-items: center; flex-wrap: wrap; }
.kpi-strip { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; margin: 18px 0; }
.kpi-mini { border: 1px solid var(--line); border-radius: 9px; padding: 13px; background: #fbfcfa; min-width: 0; }
.kpi-mini span { display: block; font-size: 10px; color: var(--muted); margin-bottom: 7px; }
.kpi-mini strong { font-size: 18px; overflow-wrap: anywhere; }
.detail-head { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; border-bottom: 1px solid var(--line); padding-bottom: 17px; margin-bottom: 17px; }
.detail-head h2 { margin: 0 0 5px; font-size: 18px; }
.detail-head p { margin: 0; color: var(--muted); font-size: 11px; }
.line-editor { display: grid; grid-template-columns: minmax(0,2fr) minmax(70px,.6fr) minmax(105px,.8fr) 38px; gap: 7px; align-items: center; margin-bottom: 8px; }
.line-editor .control { padding: 9px; font-size: 11px; }
.line-editor .remove-line { width: 34px; height: 34px; }
.document-preview { border: 1px solid var(--line); background: #f9faf8; padding: 22px; border-radius: 10px; }
.doc-head { display: flex; justify-content: space-between; gap: 20px; border-bottom: 2px solid var(--ink); padding-bottom: 18px; margin-bottom: 18px; }
.doc-brand { font-size: 20px; font-weight: 800; letter-spacing: -.06em; }
.doc-brand small { display: block; margin-top: 4px; font-size: 8px; letter-spacing: .18em; font-weight: 700; }
.doc-label { color: var(--muted); text-align: right; font-size: 11px; line-height: 1.7; }
.document-preview table { background: #fff; }
.document-preview .totals { margin-left: auto; margin-top: 15px; max-width: 290px; }
.document-preview .totals div { display: flex; justify-content: space-between; gap: 20px; padding: 5px 0; font-size: 11px; }
.document-preview .totals .grand { border-top: 1px solid #bbc4bc; margin-top: 6px; padding-top: 11px; font-weight: 750; font-size: 14px; }
.settings-grid { display: grid; grid-template-columns: minmax(0,1fr) minmax(0,1fr); gap: 17px; }
.connection-panel { display: flex; align-items: center; gap: 13px; background: #f8faf7; border: 1px solid var(--line); border-radius: 10px; padding: 15px; margin-bottom: 16px; }
.connection-icon { display: grid; place-items: center; width: 42px; height: 42px; background: var(--sidebar); color: #e5d3a6; border-radius: 11px; font-weight: 800; font-size: 11px; flex: 0 0 auto; }
.connection-panel strong { font-size: 12px; }
.connection-panel p { font-size: 11px; color: var(--muted); margin: 5px 0 0; line-height: 1.5; }
.step-list { list-style: none; padding: 0; margin: 0; counter-reset: steps; display: grid; gap: 12px; }
.step-list li { display: grid; grid-template-columns: 24px minmax(0,1fr); gap: 10px; color: var(--ink-soft); font-size: 11px; line-height: 1.7; counter-increment: steps; }
.step-list li:before { content: counter(steps); display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: var(--accent-soft); color: #7d6431; font-size: 10px; font-weight: 750; }
.step-list strong { color: #334239; }
.code-line { display: block; font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; overflow-wrap: anywhere; font-size: 10px; color: #cdd9d0; background: #18251f; border-radius: 7px; padding: 10px 11px; margin-top: 7px; }
.toast-root { position: fixed; right: 20px; bottom: 20px; display: grid; gap: 8px; z-index: 100; max-width: min(390px, calc(100vw - 40px)); }
.toast { color: #fff; background: #1e3027; border-radius: 10px; padding: 12px 15px; font-size: 12px; line-height: 1.5; box-shadow: 0 12px 35px rgba(0,0,0,.15); animation: toast-in .18s ease-out; }
.toast.error { background: #843f3a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: translateY(0); } }
.mobile-overlay { display: none; }
@media (max-width: 1100px) {
  .app-shell { grid-template-columns: 220px minmax(0,1fr); }
  .page-content { padding: 22px 20px 38px; }
  .topbar { padding: 13px 20px; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .content-grid { grid-template-columns: minmax(0,1fr); }
}
@media (max-width: 760px) {
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { min-height: 250px; padding: 25px; }
  .login-title { margin: 46px 0 30px; }
  .login-title h1 { font-size: 38px; }
  .login-title p { font-size: 12px; margin-bottom: 0; }
  .login-foot { display: none; }
  .login-side { padding: 20px; align-items: flex-start; }
  .login-card { margin-top: 0; }
  .app-shell { display: block; }
  .sidebar { position: fixed; inset: 0 auto 0 0; width: min(290px, 84vw); transform: translateX(-105%); transition: transform .18s ease; box-shadow: 12px 0 35px rgba(0,0,0,.15); }
  .sidebar.open { transform: translateX(0); }
  .mobile-overlay.show { display: block; position: fixed; inset: 0; background: rgba(10,20,15,.42); z-index: 25; }
  .menu-toggle { display: inline-flex; }
  .topbar { min-height: 65px; padding: 12px 14px; }
  .topbar h1 { font-size: 17px; }
  .top-date { display: none; }
  .topbar-right { gap: 6px; }
  .user-chip { padding: 4px 6px 4px 4px; }
  .user-chip .user-name { display: none; }
  .page-content { padding: 18px 13px 34px; }
  .page-head { display: grid; }
  .page-actions { justify-content: flex-start; }
  .metric-grid { gap: 9px; }
  .metric-card { padding: 13px; }
  .metric-value { font-size: 22px; margin-top: 14px; }
  .metric-foot { font-size: 9px; }
  .panel { padding: 13px; }
  .two-col-form, .three-col-form, .settings-grid { grid-template-columns: 1fr; }
  .line-editor { grid-template-columns: minmax(0,1fr) 65px 90px 34px; gap: 5px; }
  .line-editor .control { padding: 8px 5px; font-size: 10px; }
  .toolbar { align-items: stretch; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .toolbar-left .search-input { flex: 1; width: 100%; }
  .kpi-strip { grid-template-columns: 1fr; }
  .user-chip .user-initial { width: 24px; height: 24px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; scroll-behavior: auto !important; } }
