:root {
  color-scheme: light;
  --ink: #17232f;
  --ink-2: #2f3b46;
  --cream: #f7f3eb;
  --paper: #fffdf8;
  --line: #e5ded0;
  --gold: #b88a3b;
  --gold-soft: #f1e4c9;
  --green: #2f7d5d;
  --green-soft: #e6f3ec;
  --red: #a9473f;
  --red-soft: #fae9e6;
  --amber: #a96d17;
  --amber-soft: #fff1d8;
  --blue: #35658a;
  --blue-soft: #e8f1f7;
  --shadow: 0 18px 50px rgba(26, 32, 38, 0.08);
  --sidebar: 272px;
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--cream); }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--ink); background: var(--cream); font-size: 16px; line-height: 1.5; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .55; }

.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(420px, .9fr); background: var(--paper); }
.login-visual { position: relative; overflow: hidden; background: linear-gradient(145deg, #16232f 0%, #213646 64%, #8d6a35 160%); color: white; padding: clamp(36px, 6vw, 88px); display: flex; flex-direction: column; justify-content: space-between; }
.login-visual::after { content: ""; position: absolute; width: 520px; height: 520px; border: 1px solid rgba(209,173,104,.26); border-radius: 50%; right: -180px; bottom: -230px; box-shadow: 0 0 0 78px rgba(209,173,104,.05), 0 0 0 156px rgba(209,173,104,.035); }
.brand-mark { display: flex; align-items: center; gap: 14px; position: relative; z-index: 1; }
.brand-monogram { width: 46px; height: 46px; display: grid; place-items: center; border-radius: 14px; background: var(--gold); color: #fff; font-weight: 850; letter-spacing: -.04em; box-shadow: 0 12px 24px rgba(0,0,0,.16); }
.brand-name { font-size: 18px; font-weight: 820; letter-spacing: .08em; }
.brand-sub { display: block; font-size: 12px; font-weight: 550; opacity: .7; letter-spacing: .04em; }
.login-copy { max-width: 650px; position: relative; z-index: 1; }
.eyebrow { color: var(--gold); text-transform: uppercase; letter-spacing: .13em; font-size: 12px; font-weight: 850; }
.login-copy h1 { font-family: Georgia, "Times New Roman", serif; font-size: clamp(44px, 6vw, 78px); line-height: .98; margin: 16px 0 24px; letter-spacing: -.045em; }
.login-copy p { font-size: 18px; color: rgba(255,255,255,.72); max-width: 560px; }
.workflow-mini { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 28px; }
.workflow-mini span { border: 1px solid rgba(255,255,255,.16); background: rgba(255,255,255,.06); border-radius: 999px; padding: 7px 11px; font-size: 12px; }
.login-panel { padding: clamp(30px, 6vw, 92px); display: grid; place-items: center; background: radial-gradient(circle at top right, #f4ead5 0, transparent 38%), var(--paper); }
.login-card { width: min(100%, 470px); }
.login-card h2 { margin: 18px 0 8px; font-size: 31px; letter-spacing: -.03em; }
.login-card > p { color: #66717a; margin: 0 0 28px; }
.demo-ribbon { display: inline-flex; gap: 8px; align-items: center; color: var(--amber); background: var(--amber-soft); padding: 8px 11px; border-radius: 8px; font-size: 12px; font-weight: 800; }
.form-field { display: grid; gap: 7px; margin-bottom: 16px; }
.form-field span { font-weight: 750; font-size: 14px; color: var(--ink-2); }
input, select, textarea { width: 100%; border: 1px solid #d9d2c5; border-radius: 10px; background: #fff; color: var(--ink); padding: 11px 12px; min-height: 44px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(184,138,59,.13); }
textarea { min-height: 90px; resize: vertical; }
.credential-note { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: var(--cream); font-size: 13px; margin: 20px 0; }
.credential-note code { display: block; font-family: inherit; color: var(--ink); }

.app-shell { min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); background: #17232f; color: #fff; padding: 24px 16px 18px; display: flex; flex-direction: column; z-index: 40; overflow-y: auto; }
.sidebar .brand-mark { padding: 0 8px 24px; border-bottom: 1px solid rgba(255,255,255,.1); }
.side-nav { display: grid; gap: 4px; margin-top: 20px; }
.nav-item { border: 0; background: transparent; color: rgba(255,255,255,.68); text-align: left; border-radius: 10px; padding: 10px 12px; display: flex; align-items: center; gap: 11px; font-size: 14px; font-weight: 670; }
.nav-item:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav-item.active { background: rgba(209,173,104,.17); color: #f5d99f; box-shadow: inset 3px 0 0 var(--gold); }
.nav-icon { width: 22px; text-align: center; opacity: .9; }
.powered { margin-top: auto; border-top: 1px solid rgba(255,255,255,.1); padding: 18px 9px 0; font-size: 11px; color: rgba(255,255,255,.52); }
.powered strong { color: rgba(255,255,255,.78); display: block; margin-bottom: 2px; }

.main { margin-left: var(--sidebar); min-height: 100vh; }
.topbar { min-height: 76px; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 16px; justify-content: space-between; padding: 14px clamp(18px, 3vw, 42px); border-bottom: 1px solid rgba(220,211,195,.85); background: rgba(247,243,235,.92); backdrop-filter: blur(16px); }
.topbar h1 { margin: 0; font-size: 22px; letter-spacing: -.025em; }
.topbar p { margin: 1px 0 0; color: #69737b; font-size: 13px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.demo-badge { padding: 7px 9px; border-radius: 8px; color: var(--amber); background: var(--amber-soft); font-size: 11px; font-weight: 850; letter-spacing: .04em; white-space: nowrap; }
.avatar { width: 38px; height: 38px; border-radius: 50%; background: var(--gold-soft); display: grid; place-items: center; color: #6f4c17; font-weight: 850; }
.menu-button { display: none; }
.content { padding: clamp(20px, 3vw, 42px); max-width: 1600px; margin: auto; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 24px; }
.page-head h2 { margin: 0; font-size: 28px; letter-spacing: -.035em; }
.page-head p { margin: 5px 0 0; color: #69737b; }
.page-actions { display: flex; gap: 9px; flex-wrap: wrap; }

.button { border: 0; border-radius: 10px; background: var(--ink); color: #fff; min-height: 42px; padding: 9px 15px; font-weight: 760; display: inline-flex; gap: 8px; align-items: center; justify-content: center; }
.button:hover { filter: brightness(1.08); }
.button.gold { background: var(--gold); }
.button.outline { background: transparent; color: var(--ink); border: 1px solid #d5ccbc; }
.button.soft { background: var(--gold-soft); color: #6b4b18; }
.button.danger { background: var(--red); }
.button.small { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink); }

.metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.metric-card, .panel { background: var(--paper); border: 1px solid rgba(220,211,195,.82); border-radius: 16px; box-shadow: 0 9px 28px rgba(37,43,48,.045); }
.metric-card { padding: 18px; min-height: 128px; position: relative; overflow: hidden; }
.metric-card::after { content: ""; position: absolute; width: 80px; height: 80px; border-radius: 50%; background: var(--gold-soft); right: -32px; bottom: -34px; opacity: .7; }
.metric-label { color: #68737c; font-size: 13px; font-weight: 700; }
.metric-value { display: block; margin: 8px 0 3px; font-size: 29px; font-weight: 850; letter-spacing: -.04em; }
.metric-note { color: #879097; font-size: 12px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 18px; margin-bottom: 18px; }
.grid-even { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.panel { padding: 20px; }
.panel-head { display: flex; justify-content: space-between; gap: 14px; align-items: center; margin-bottom: 16px; }
.panel-head h3 { margin: 0; font-size: 17px; }
.panel-head p { margin: 2px 0 0; color: #7a838a; font-size: 12px; }
.attention-list { display: grid; gap: 9px; }
.attention-item { border: 1px solid var(--line); border-left-width: 4px; border-radius: 11px; padding: 12px; display: grid; grid-template-columns: 86px 1fr auto; gap: 12px; align-items: center; background: #fff; }
.attention-item.high { border-left-color: var(--red); }
.attention-item.medium { border-left-color: var(--amber); }
.attention-item.low { border-left-color: var(--blue); }
.attention-title { font-weight: 780; }
.attention-meta { color: #7b858d; font-size: 12px; }
.priority { text-transform: uppercase; letter-spacing: .08em; font-size: 10px; font-weight: 900; }
.priority.high { color: var(--red); }
.priority.medium { color: var(--amber); }
.priority.low { color: var(--blue); }

.pipeline { display: grid; grid-template-columns: repeat(6, minmax(90px, 1fr)); gap: 8px; }
.pipeline-step { min-height: 82px; border: 1px solid var(--line); border-radius: 10px; padding: 11px; background: #fff; }
.pipeline-step strong { font-size: 20px; display: block; }
.pipeline-step span { color: #6f7981; font-size: 11px; line-height: 1.25; display: block; }
.financial { display: grid; gap: 13px; }
.financial-row { display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: 11px; }
.financial-row:last-child { border-bottom: 0; }
.financial-row span { color: #66717a; font-size: 13px; }
.financial-row strong { font-size: 17px; }
.progress { height: 9px; background: #ece5d9; border-radius: 99px; overflow: hidden; }
.progress > span { height: 100%; background: linear-gradient(90deg, var(--gold), #d8b873); display: block; border-radius: inherit; }

.toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 15px; }
.search { min-width: min(320px, 100%); flex: 1; position: relative; }
.search input { padding-left: 38px; }
.search::before { content: "⌕"; position: absolute; left: 13px; top: 8px; color: #7b858d; font-size: 22px; z-index: 1; }
.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 13px; background: #fff; }
table { width: 100%; border-collapse: collapse; min-width: 820px; }
th { text-align: left; color: #69737b; background: #f6f2ea; font-size: 11px; text-transform: uppercase; letter-spacing: .07em; padding: 12px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 13px 14px; border-bottom: 1px solid #eee8de; font-size: 13px; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fffcf5; }
.cell-main { font-weight: 780; }
.cell-sub { display: block; color: #78828a; font-size: 11px; margin-top: 2px; }
.status { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; white-space: nowrap; background: #edf0f2; color: #52606c; }
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.status.green { background: var(--green-soft); color: var(--green); }
.status.gold { background: var(--gold-soft); color: #835d1f; }
.status.red { background: var(--red-soft); color: var(--red); }
.status.blue { background: var(--blue-soft); color: var(--blue); }

.kanban { display: grid; grid-template-columns: repeat(4, minmax(245px, 1fr)); gap: 13px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { background: #efe9df; border-radius: 14px; padding: 12px; min-height: 290px; }
.kanban-head { display: flex; justify-content: space-between; margin-bottom: 11px; font-size: 13px; font-weight: 850; }
.job-card { background: #fff; border: 1px solid #e0d8ca; border-radius: 12px; padding: 14px; margin-bottom: 10px; box-shadow: 0 6px 15px rgba(30,35,40,.04); }
.job-card h4 { margin: 0 0 3px; font-size: 14px; }
.job-card p { margin: 0 0 10px; color: #768088; font-size: 12px; }
.job-meta { display: flex; justify-content: space-between; gap: 8px; font-size: 11px; color: #69737b; margin-top: 10px; }

.flow-card { background: linear-gradient(135deg, #17232f, #253c4d); color: white; border: 0; position: relative; overflow: hidden; }
.flow-card::after { content: ""; position: absolute; width: 180px; height: 180px; border: 1px solid rgba(209,173,104,.25); border-radius: 50%; right: -90px; top: -85px; }
.flow-card h3 { font-size: 21px; margin: 0 0 6px; }
.flow-card p { color: rgba(255,255,255,.7); margin: 0 0 18px; }
.flow-progress { display: flex; gap: 4px; margin: 14px 0; }
.flow-progress span { height: 5px; flex: 1; background: rgba(255,255,255,.16); border-radius: 8px; }
.flow-progress span.done { background: var(--gold); }
.flow-next { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.flow-next strong { display: block; color: #f1cf8f; }
.flow-next small { color: rgba(255,255,255,.62); }

.charts { display: grid; gap: 14px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 45px; gap: 10px; align-items: center; font-size: 12px; }
.bar-track { height: 11px; background: #ece6db; border-radius: 99px; overflow: hidden; }
.bar-track span { display: block; height: 100%; background: linear-gradient(90deg, #b4873b, #d5b573); border-radius: inherit; }
.donut { width: 170px; aspect-ratio: 1; border-radius: 50%; margin: 12px auto; display: grid; place-items: center; background: conic-gradient(var(--green) 0 62%, var(--gold) 62% 83%, #d9d2c6 83%); }
.donut::after { content: "62%"; width: 112px; aspect-ratio: 1; background: var(--paper); border-radius: 50%; display: grid; place-items: center; font-size: 23px; font-weight: 850; }
.ai-hero { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(300px, .8fr); gap: 18px; }
.ai-chat { min-height: 520px; display: flex; flex-direction: column; }
.ai-message { max-width: 82%; padding: 13px 15px; border-radius: 14px; margin-bottom: 11px; font-size: 14px; }
.ai-message.assistant { background: #f0ebe1; border-bottom-left-radius: 4px; }
.ai-message.user { background: var(--ink); color: #fff; align-self: flex-end; border-bottom-right-radius: 4px; }
.ai-composer { margin-top: auto; display: flex; gap: 8px; padding-top: 16px; }
.ai-composer input { flex: 1; }
.suggestions { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 15px; }
.chip { border: 1px solid var(--line); background: #fff; color: var(--ink); padding: 7px 10px; border-radius: 999px; font-size: 11px; }
.alert-card { border-left: 4px solid var(--gold); padding: 13px; background: #fff; border-radius: 9px; margin-bottom: 9px; }
.alert-card strong { font-size: 13px; display: block; }
.alert-card span { color: #737d85; font-size: 12px; }

.settings-list { display: grid; gap: 12px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--line); padding-bottom: 13px; }
.setting-row:last-child { border-bottom: 0; }
.setting-row strong { display: block; }
.setting-row span { color: #737d85; font-size: 12px; }
.percentage-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.percentage-box { padding: 15px; border: 1px solid var(--line); background: #fff; border-radius: 12px; }
.percentage-box strong { font-size: 24px; display: block; }
.percentage-box span { color: #78828a; font-size: 12px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 100; background: rgba(16,24,31,.62); display: grid; place-items: center; padding: 18px; backdrop-filter: blur(5px); }
.modal { width: min(680px, 100%); max-height: calc(100vh - 36px); overflow-y: auto; background: var(--paper); border-radius: 18px; box-shadow: 0 30px 90px rgba(0,0,0,.25); }
.modal-head { padding: 20px 22px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; }
.modal-body { padding: 22px; }
.modal-actions { padding: 16px 22px 22px; display: flex; justify-content: flex-end; gap: 9px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.notice { border: 1px solid #ead4a9; background: #fff6df; color: #765315; padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 16px; }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 200; background: var(--ink); color: #fff; border-left: 4px solid var(--gold); border-radius: 11px; padding: 13px 16px; box-shadow: 0 18px 55px rgba(0,0,0,.22); max-width: 380px; animation: toast-in .2s ease; }
@keyframes toast-in { from { transform: translateY(10px); opacity: 0; } }
.empty { padding: 42px 18px; text-align: center; color: #748089; }
.mobile-overlay { display: none; }

@media (max-width: 1180px) {
  .metrics { grid-template-columns: repeat(2, 1fr); }
  .pipeline { grid-template-columns: repeat(4, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .login-shell { grid-template-columns: 1fr; }
  .login-visual { min-height: 38vh; padding: 30px; }
  .login-copy h1 { font-size: 43px; }
  .workflow-mini { display: none; }
  .login-panel { padding: 34px 22px; }
  .sidebar { transform: translateX(-100%); transition: transform .22s ease; box-shadow: 20px 0 50px rgba(0,0,0,.22); }
  .sidebar.open { transform: translateX(0); }
  .mobile-overlay.open { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(14,21,27,.52); }
  .main { margin-left: 0; }
  .menu-button { display: grid; place-items: center; }
  .topbar { padding: 12px 16px; }
  .topbar h1 { font-size: 18px; }
  .topbar p { display: none; }
  .content { padding: 20px 14px 34px; }
  .page-head { flex-direction: column; }
  .grid-even, .ai-hero { grid-template-columns: 1fr; }
  .pipeline { grid-template-columns: repeat(3, 1fr); }
  .attention-item { grid-template-columns: 70px 1fr; }
  .attention-item .button { grid-column: 2; justify-self: start; }
}

@media (max-width: 560px) {
  .metrics { grid-template-columns: 1fr 1fr; gap: 9px; }
  .metric-card { padding: 14px; min-height: 112px; }
  .metric-value { font-size: 23px; }
  .metric-label { font-size: 12px; }
  .metric-note { display: none; }
  .pipeline { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .full { grid-column: auto; }
  .percentage-grid { grid-template-columns: 1fr; }
  .demo-badge { display: none; }
  .page-actions, .page-actions .button { width: 100%; }
  .panel { padding: 15px; }
  .flow-next { align-items: flex-start; flex-direction: column; }
  .flow-next .button { width: 100%; }
  .bar-row { grid-template-columns: 95px 1fr 32px; }
  .toast { left: 14px; right: 14px; bottom: 14px; }
}
