:root {
  --green-950: #0a2d25;
  --green-900: #123c31;
  --green-800: #19513f;
  --green-700: #1d684d;
  --green-600: #2e8b58;
  --green-100: #e5f2eb;
  --green-50: #f3f8f5;
  --gold-600: #a67417;
  --gold-100: #faefd6;
  --blue-600: #2870a5;
  --blue-100: #e6f1f8;
  --coral-600: #b44a42;
  --coral-100: #f9e8e6;
  --ink: #18231f;
  --muted: #67746f;
  --line: #dbe4df;
  --surface: #ffffff;
  --canvas: #f3f6f4;
  --sidebar-width: 272px;
  --radius: 7px;
  --shadow: 0 10px 28px rgba(19, 54, 43, .08);
}

* { box-sizing: border-box; }
html { color-scheme: light; }
body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  color: var(--ink);
  background: var(--canvas);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  line-height: 1.45;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
img, svg { display: block; }
a { color: var(--green-700); }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid rgba(46, 139, 88, .28); outline-offset: 2px; }

.auth-layout { min-height: 100vh; display: grid; grid-template-columns: minmax(480px, 1.3fr) minmax(420px, .7fr); }
.auth-brand {
  min-height: 100vh;
  padding: 42px clamp(36px, 6vw, 88px);
  color: white;
  background: var(--green-950) url("assets/images/backgrounds/professional_meeting.jpg") center/cover no-repeat;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  isolation: isolate;
}
.auth-brand::before { content: ""; position: absolute; inset: 0; z-index: -1; background: rgba(10, 45, 37, .89); }
.brand-mark { display: inline-flex; align-items: center; width: 210px; height: 62px; }
.brand-mark img { width: 100%; max-height: 100%; object-fit: contain; object-position: left center; }
.brand-mark-light { padding: 8px; border: 1px solid rgba(255,255,255,.18); background: rgba(255,255,255,.08); border-radius: var(--radius); }
.auth-brand-copy { max-width: 670px; }
.context-label { display: inline-block; color: #dcece4; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.context-label-dark { color: var(--green-700); }
.auth-brand-copy h1 { margin: 16px 0 18px; max-width: 630px; font-size: clamp(42px, 5vw, 67px); line-height: 1.02; letter-spacing: 0; }
.auth-brand-copy p { margin: 0; max-width: 600px; color: #d4e4dc; font-size: 18px; }
.auth-security { display: flex; gap: 9px; align-items: center; margin: 0; color: #c8ddd2; font-size: 13px; }
.auth-security svg { width: 18px; height: 18px; }
.auth-form-side { display: grid; place-items: center; min-height: 100vh; padding: 34px; background: #eef3f0; }
.auth-panel { width: 100%; max-width: 430px; padding: 34px; background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.auth-logo { width: 205px; height: 58px; object-fit: contain; object-position: left center; margin-bottom: 28px; }
.auth-panel h2 { margin: 7px 0 7px; font-size: 29px; letter-spacing: 0; }
.auth-panel > p { margin: 0 0 24px; color: var(--muted); }
.auth-help, .preview-note { margin: 20px 0 0 !important; font-size: 12px; text-align: center; }
.preview-note { color: var(--gold-600) !important; }

.field { display: grid; gap: 7px; margin-bottom: 15px; }
.field > span:first-child, .field-label { font-size: 12px; font-weight: 750; color: #32423c; }
.input-wrap { min-height: 44px; display: flex; align-items: center; gap: 9px; padding: 0 11px; border: 1px solid #cbd7d1; border-radius: 6px; background: white; }
.input-wrap:focus-within { border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(46,139,88,.13); }
.input-wrap svg { width: 17px; height: 17px; color: #77847e; flex: none; }
.input-wrap input { min-width: 0; width: 100%; height: 42px; border: 0; outline: 0; color: var(--ink); background: transparent; }
input, select, textarea { width: 100%; border: 1px solid #cbd7d1; border-radius: 6px; background: white; color: var(--ink); padding: 10px 11px; }
input, select { min-height: 42px; }
textarea { min-height: 102px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 0; border-color: var(--green-600); box-shadow: 0 0 0 3px rgba(46,139,88,.13); }
.field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 13px; }
.field-wide { grid-column: 1 / -1; }
.record-lookup { display: grid; gap: 8px; margin-bottom: 15px; padding: 12px; border: 1px solid #cfdad4; border-radius: 6px; background: #f9fbfa; }
.lookup-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; margin-top: 7px; }
.lookup-preview { margin: 0; color: var(--green-800); font-size: 11px; font-weight: 700; overflow-wrap: anywhere; }
.lookup-suggestions { display: grid; gap: 6px; max-height: 220px; overflow-y: auto; padding-top: 2px; }
.lookup-suggestion { width: 100%; display: grid; grid-template-columns: 74px minmax(0,1fr); gap: 3px 9px; padding: 9px 10px; border: 1px solid #d8e2dd; border-radius: 6px; background: white; color: var(--ink); text-align: left; }
.lookup-suggestion:hover, .lookup-suggestion:focus-visible { border-color: var(--green-600); background: var(--green-50); outline: 0; }
.lookup-suggestion span { grid-row: span 2; align-self: center; justify-self: start; padding: 3px 7px; border-radius: 999px; color: var(--green-800); background: var(--green-100); font-size: 9px; font-weight: 850; text-transform: uppercase; }
.lookup-suggestion strong { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.lookup-suggestion small { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 10px; }
.check-field { display: flex; align-items: flex-start; gap: 9px; font-size: 13px; color: var(--muted); }
.check-field input { width: 17px; min-height: 17px; margin-top: 2px; }
.module-choice-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 8px; }
.module-choice { min-height: 54px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; background: #f8fbf9; font-weight: 750; }
.module-choice span { display: block; margin-left: auto; color: var(--muted); font-size: 10px; font-weight: 700; }
.module-choice input:disabled { opacity: .65; }
.form-message, .inline-alert { display: none; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; margin: 10px 0 14px; font-size: 13px; }
.form-message.show, .inline-alert.show { display: block; }
.form-message.error, .inline-alert.error { border-color: #edc6c3; color: #8e302a; background: #fff3f2; }
.form-message.success, .inline-alert.success { border-color: #bfdacb; color: var(--green-800); background: var(--green-50); }

.button { min-height: 40px; border: 1px solid transparent; border-radius: 6px; padding: 9px 14px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 750; font-size: 13px; }
.button svg { width: 17px; height: 17px; }
.button-primary { color: white; background: var(--green-700); border-color: var(--green-700); }
.button-primary:hover { background: var(--green-800); }
.button-secondary { color: var(--ink); background: white; border-color: var(--line); }
.button-secondary:hover { background: var(--green-50); }
.button-danger { color: #94372f; background: var(--coral-100); border-color: #edc7c4; }
.button-small { min-height: 33px; padding: 6px 10px; font-size: 12px; }
.button-full { width: 100%; }
.button:disabled { cursor: wait; opacity: .62; }
.icon-button { width: 40px; height: 40px; padding: 0; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 6px; color: #4f5f58; background: white; }
.icon-button:hover { color: var(--green-700); background: var(--green-50); }
.icon-button svg { width: 18px; height: 18px; }

.app { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; min-width: 0; display: grid; grid-template-rows: auto minmax(0,1fr) auto; color: white; background: var(--green-950); z-index: 30; }
.sidebar-head { height: 82px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 18px; border-bottom: 1px solid rgba(255,255,255,.1); }
.sidebar-head img { width: 190px; max-height: 48px; object-fit: contain; object-position: left center; }
.sidebar-close { display: none; }
.icon-button-dark { width: 34px; height: 34px; color: #d1e2d9; background: transparent; border-color: rgba(255,255,255,.15); }
.icon-button-dark:hover { color: white; background: rgba(255,255,255,.08); }
.sidebar-nav { overflow-y: auto; padding: 17px 12px; scrollbar-width: thin; }
.nav-section { margin-bottom: 18px; }
.nav-heading { display: block; padding: 0 10px 7px; color: #789c8e; font-size: 10px; font-weight: 800; text-transform: uppercase; }
.nav-item { width: 100%; min-height: 42px; display: grid; grid-template-columns: 19px minmax(0,1fr) auto; align-items: center; gap: 10px; margin: 2px 0; padding: 9px 10px; color: #ccddd5; background: transparent; border: 1px solid transparent; border-radius: 6px; text-align: left; font-size: 13px; font-weight: 650; }
.nav-item svg { width: 18px; height: 18px; }
.nav-item b { min-width: 21px; height: 21px; display: grid; place-items: center; padding: 0 5px; color: #f2d58f; background: rgba(242,213,143,.13); border-radius: 999px; font-size: 10px; }
.nav-item:hover { color: white; background: rgba(255,255,255,.05); }
.nav-item.active { color: white; background: var(--green-700); border-color: rgba(255,255,255,.08); }
.nav-item.active::after { content: ''; width: 7px; height: 7px; border-radius: 999px; background: var(--gold-600); box-shadow: 0 0 0 0 rgba(242,213,143,.55); animation: pulse-dot 1.8s ease-out infinite; }
.sidebar-account { min-height: 78px; display: grid; grid-template-columns: 38px minmax(0,1fr) auto; align-items: center; gap: 10px; padding: 13px 15px; border-top: 1px solid rgba(255,255,255,.1); }
.sidebar-account strong, .sidebar-account span { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-account strong { font-size: 12px; }
.sidebar-account span { margin-top: 2px; color: #8fb0a3; font-size: 10px; }
.avatar { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; color: white; background: var(--green-600); font-weight: 800; font-size: 12px; }
.avatar-small { width: 32px; height: 32px; }

.main-workspace { min-width: 0; }
.topbar { height: 70px; position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 0 clamp(18px, 2.5vw, 34px); background: rgba(255,255,255,.97); border-bottom: 1px solid var(--line); }
.topbar-left, .topbar-actions { display: flex; align-items: center; gap: 10px; min-width: 0; }
.menu-button { display: none; }
.global-search { width: min(520px, 42vw); height: 40px; display: flex; align-items: center; gap: 9px; padding: 0 10px; border: 1px solid var(--line); border-radius: 6px; background: #f9fbfa; }
.global-search svg { width: 17px; height: 17px; color: var(--muted); }
.global-search input { min-width: 0; height: 38px; min-height: 38px; padding: 0; border: 0; outline: 0; box-shadow: none; background: transparent; }
.global-search kbd { padding: 2px 5px; border: 1px solid #d8e0dc; border-radius: 4px; color: #7b8782; background: white; font-size: 10px; white-space: nowrap; }
.connection-pill { display: inline-flex; align-items: center; gap: 6px; min-height: 30px; padding: 5px 9px; color: var(--green-800); background: var(--green-100); border-radius: 999px; font-size: 11px; font-weight: 750; }
.connection-pill.offline { color: var(--gold-600); background: var(--gold-100); }
.connection-pill svg { width: 14px; height: 14px; }
.profile-button { display: flex; align-items: center; gap: 9px; min-height: 44px; padding: 5px 8px; border: 0; background: transparent; text-align: left; }
.profile-button > span:not(.avatar) { min-width: 0; }
.profile-button strong, .profile-button small { display: block; max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-button strong { font-size: 12px; }
.profile-button small { color: var(--muted); font-size: 10px; }
.profile-button > svg { width: 15px; height: 15px; color: var(--muted); }

.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 18px; padding: 24px clamp(18px, 2.5vw, 34px) 17px; }
.breadcrumb { display: flex; align-items: center; gap: 5px; margin: 0 0 6px; color: var(--muted); font-size: 11px; }
.breadcrumb svg { width: 13px; height: 13px; }
.breadcrumb strong { color: var(--green-700); }
.page-heading h1 { margin: 0; font-size: 27px; letter-spacing: 0; }
.page-heading > div > p:last-child { margin: 4px 0 0; color: var(--muted); font-size: 13px; }
.page-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.currency-switch { min-height: 44px; display: flex; align-items: center; gap: 4px; padding: 5px; border: 1px solid var(--line); border-radius: 7px; background: white; align-self: flex-start; }
.currency-switch button { min-width: 64px; height: 32px; border: 0; border-radius: 5px; color: var(--muted); background: transparent; font-size: 12px; font-weight: 800; }
.currency-switch button.active { color: white; background: var(--green-700); }
.currency-switch span { padding: 0 8px; color: var(--muted); font-size: 11px; }
.inline-alert { margin: 0 clamp(18px, 2.5vw, 34px) 14px; }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 12px; padding: 0 clamp(18px, 2.5vw, 34px) 14px; }
.metric-card { min-width: 0; min-height: 112px; display: grid; grid-template-columns: minmax(0,1fr) 40px; gap: 10px; padding: 15px; background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 5px 16px rgba(26, 60, 48, .04); }
.metric-card span { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.metric-card strong { display: block; margin-top: 7px; font-size: 28px; line-height: 1; animation: metric-rise .32s ease-out; }
.metric-card small { display: block; margin-top: 9px; color: #7b8882; font-size: 10px; }
.metric-icon { width: 38px; height: 38px; display: grid !important; place-items: center; border-radius: 6px; color: var(--green-700) !important; background: var(--green-100); }
.metric-icon.gold { color: var(--gold-600) !important; background: var(--gold-100); }
.metric-icon.blue { color: var(--blue-600) !important; background: var(--blue-100); }
.metric-icon.coral { color: var(--coral-600) !important; background: var(--coral-100); }
.metric-icon svg { width: 19px; height: 19px; }

.view-region { min-width: 0; padding: 0 clamp(18px, 2.5vw, 34px) 28px; }
.dashboard-layout { display: grid; grid-template-columns: minmax(0,1.55fr) minmax(330px,.85fr); gap: 14px; }
.stack { display: grid; align-content: start; gap: 14px; }
.panel { min-width: 0; background: white; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 5px 16px rgba(26,60,48,.04); overflow: hidden; }
.panel-head { min-height: 62px; display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 15px; border-bottom: 1px solid var(--line); }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 15px; }
.panel-head p { margin: 3px 0 0; color: var(--muted); font-size: 11px; }
.panel-body { padding: 15px; }
.panel-body-flush { padding: 0; }
.panel-actions { display: flex; gap: 7px; align-items: center; }
.section-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 14px; }
.section-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }

.quick-actions { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 8px; }
.quick-action { min-height: 80px; display: grid; align-content: center; justify-items: start; gap: 7px; padding: 11px; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); background: #fbfcfb; text-align: left; font-size: 11px; font-weight: 700; }
.quick-action:hover { border-color: #a9c8b9; background: var(--green-50); }
.quick-action svg { width: 19px; height: 19px; color: var(--green-700); }
.queue { display: grid; }
.queue-item { display: grid; grid-template-columns: 34px minmax(0,1fr) auto; align-items: center; gap: 10px; min-height: 64px; padding: 10px 15px; border-bottom: 1px solid #e8eeeb; }
.queue-item:last-child { border-bottom: 0; }
.queue-icon { width: 33px; height: 33px; display: grid; place-items: center; border-radius: 6px; color: var(--gold-600); background: var(--gold-100); }
.queue-icon svg { width: 17px; height: 17px; }
.queue-item strong, .queue-item span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue-item strong { font-size: 12px; }
.queue-item span { margin-top: 2px; color: var(--muted); font-size: 10px; }

.pipeline { display: grid; grid-template-columns: repeat(5, minmax(0,1fr)); gap: 8px; }
.pipeline-step { min-width: 0; padding: 11px; border-left: 3px solid var(--green-600); background: var(--green-50); }
.pipeline-step.success { border-color: var(--green-600); background: var(--green-50); }
.pipeline-step.warn { border-color: var(--gold-600); background: var(--gold-100); }
.pipeline-step.blue { border-color: var(--blue-600); background: var(--blue-100); }
.pipeline-step.danger { border-color: var(--coral-600); background: var(--coral-100); }
.pipeline-step.neutral { border-color: #5c7168; background: #edf1ef; }
.pipeline-step span, .pipeline-step strong { display: block; }
.pipeline-step span { color: var(--muted); font-size: 9px; font-weight: 750; text-transform: uppercase; }
.pipeline-step strong { margin-top: 5px; font-size: 21px; }

.filterbar { display: grid; grid-template-columns: minmax(240px,1fr) repeat(3, minmax(130px,180px)); gap: 8px; padding: 12px 15px; border-bottom: 1px solid var(--line); background: #fafcfb; }
.filterbar.two { grid-template-columns: minmax(240px,1fr) minmax(140px,190px); }
.table-wrap { overflow-x: auto; }
table { width: 100%; min-width: 850px; border-collapse: collapse; }
th, td { padding: 11px 13px; border-bottom: 1px solid #e7ece9; text-align: left; vertical-align: middle; font-size: 11px; }
th { color: #6d7b75; background: #f8faf9; font-size: 9px; font-weight: 800; text-transform: uppercase; white-space: nowrap; }
tbody tr:hover { background: #fafcfb; }
tbody tr:last-child td { border-bottom: 0; }
.cell-main { display: block; color: var(--ink); font-size: 11px; font-weight: 750; }
.cell-sub { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.cell-actions { display: flex; align-items: center; justify-content: flex-end; gap: 5px; white-space: nowrap; }
.table-action { min-width: 31px; height: 31px; display: inline-grid; place-items: center; border: 1px solid var(--line); border-radius: 5px; color: #52635b; background: white; }
.table-action:hover { color: var(--green-700); background: var(--green-50); }
.table-action.danger { color: var(--danger); }
.table-action.danger:hover { color: #8f1f1f; background: #fff1f1; border-color: #efb8b8; }
.table-action svg { width: 15px; height: 15px; }
.status { display: inline-flex; align-items: center; min-height: 23px; padding: 3px 8px; border-radius: 999px; color: var(--green-800); background: var(--green-100); font-size: 9px; font-weight: 800; white-space: nowrap; }
.status::before { content: ""; width: 5px; height: 5px; margin-right: 5px; border-radius: 50%; background: currentColor; }
.status.warn { color: #8b6116; background: var(--gold-100); }
.status.danger { color: #993b34; background: var(--coral-100); }
.status.blue { color: var(--blue-600); background: var(--blue-100); }
.status.neutral { color: #627169; background: #edf1ef; }
.priority { font-size: 10px; font-weight: 800; }
.priority.high { color: var(--coral-600); }
.priority.normal { color: var(--blue-600); }

.empty-state { min-height: 180px; display: grid; place-items: center; align-content: center; gap: 7px; padding: 30px; color: var(--muted); text-align: center; }
.empty-state svg { width: 28px; height: 28px; color: #9aaca3; }
.empty-state strong { color: var(--ink); font-size: 13px; }
.empty-state p { max-width: 390px; margin: 0; font-size: 11px; }
.loading-state { min-height: 260px; display: grid; place-items: center; gap: 10px; color: var(--muted); text-align: center; }
.loading-state svg { width: 30px; height: 30px; color: var(--green-700); animation: spin 1s linear infinite; }
.loading-state strong { color: var(--ink); font-size: 15px; }
.loading-state span { font-size: 12px; }
.spin { animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse-dot { 70% { box-shadow: 0 0 0 8px rgba(242,213,143,0); } 100% { box-shadow: 0 0 0 0 rgba(242,213,143,0); } }
@keyframes metric-rise { from { opacity: .35; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

.case-layout { display: grid; grid-template-columns: 330px minmax(0,1fr); gap: 14px; }
.record-list { max-height: calc(100vh - 240px); overflow-y: auto; }
.record-item { width: 100%; display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 8px; padding: 13px 14px; border: 0; border-bottom: 1px solid var(--line); color: var(--ink); background: white; text-align: left; }
.record-item:hover, .record-item.active { background: var(--green-50); }
.record-item.active { box-shadow: inset 3px 0 var(--green-600); }
.record-item strong, .record-item span { display: block; }
.record-item strong { font-size: 12px; }
.record-item span { margin-top: 3px; color: var(--muted); font-size: 9px; }
.record-item .status { max-width: 122px; justify-self: end; align-self: center; justify-content: center; min-height: 29px; padding: 5px 9px; line-height: 1.2; text-align: center; white-space: normal; }
.record-item .status::before { display: none; }
.case-hero { padding: 17px; display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; border-bottom: 1px solid var(--line); }
.case-person { display: flex; align-items: center; gap: 11px; }
.case-person h2 { margin: 0; font-size: 18px; }
.case-person p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }
.case-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }
.detail-strip { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border-bottom: 1px solid var(--line); }
.detail-item { min-width: 0; padding: 12px 14px; border-right: 1px solid var(--line); }
.detail-item:last-child { border-right: 0; }
.detail-item span, .detail-item strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.detail-item span { color: var(--muted); font-size: 9px; text-transform: uppercase; font-weight: 750; }
.detail-item strong { margin-top: 4px; font-size: 11px; }
.record-tabs { display: flex; gap: 18px; padding: 0 15px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.record-tab { min-height: 44px; display: inline-flex; align-items: center; padding: 0; border: 0; border-bottom: 2px solid transparent; color: var(--muted); background: transparent; font-size: 10px; font-weight: 750; white-space: nowrap; }
.record-tab.active { color: var(--green-700); border-bottom-color: var(--green-600); }
.case-content { padding: 16px; }
.timeline { display: grid; }
.timeline-item { position: relative; margin-left: 7px; padding: 0 0 18px 20px; border-left: 1px solid #cfdad4; }
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before { content: ""; position: absolute; left: -5px; top: 2px; width: 9px; height: 9px; border: 2px solid white; border-radius: 50%; background: var(--green-600); box-shadow: 0 0 0 1px var(--green-600); }
.timeline-item strong { display: block; font-size: 11px; }
.timeline-item span { display: block; margin-top: 3px; color: var(--muted); font-size: 9px; }
.note-list { display: grid; gap: 8px; }
.note { padding: 11px 12px; border-left: 3px solid var(--blue-600); background: #f8fbfd; }
.note.important { border-color: var(--coral-600); background: #fff8f7; }
.note-head { display: flex; justify-content: space-between; gap: 12px; font-size: 9px; color: var(--muted); }
.note p { margin: 6px 0 0; font-size: 11px; white-space: pre-wrap; }
.note-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 9px; padding-top: 8px; border-top: 1px solid rgba(40,112,165,.12); color: var(--muted); font-size: 9px; }
.note-foot span { overflow-wrap: anywhere; }

.appointment-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.appointment-card { min-width: 0; padding: 12px; border: 1px solid var(--line); border-radius: 6px; background: white; }
.appointment-card time { color: var(--green-700); font-size: 10px; font-weight: 800; }
.appointment-card h3 { margin: 7px 0 4px; font-size: 12px; }
.appointment-card p { margin: 0; color: var(--muted); font-size: 10px; }
.appointment-card footer { display: flex; justify-content: space-between; align-items: center; gap: 7px; margin-top: 11px; padding-top: 9px; border-top: 1px solid var(--line); }

.bars { display: grid; gap: 11px; }
.bar-row { display: grid; grid-template-columns: minmax(0,1fr) auto; gap: 4px 12px; align-items: center; }
.bar-row span, .bar-row strong { font-size: 10px; }
.bar-track { grid-column: 1 / -1; height: 7px; overflow: hidden; border-radius: 999px; background: #edf1ef; }
.bar-track i { display: block; width: var(--bar,0%); height: 100%; border-radius: inherit; background: var(--green-600); }
.bar-row.success .bar-track i { background: var(--green-600); }
.bar-row.warn .bar-track i { background: var(--gold-600); }
.bar-row.blue .bar-track i { background: var(--blue-600); }
.bar-row.danger .bar-track i { background: var(--coral-600); }
.bar-row.neutral .bar-track i { background: #5c7168; }
.system-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.system-item { min-width: 0; padding: 13px; border: 1px solid var(--line); border-radius: 6px; background: #fbfcfb; }
.system-item span, .system-item strong { display: block; overflow-wrap: anywhere; }
.system-item span { color: var(--muted); font-size: 9px; text-transform: uppercase; font-weight: 750; }
.system-item strong { margin-top: 6px; font-size: 11px; }
.audit-list { display: grid; }
.audit-row { display: grid; grid-template-columns: 9px minmax(0,1fr) auto; gap: 10px; padding: 11px 15px; border-bottom: 1px solid var(--line); }
.audit-row:last-child { border-bottom: 0; }
.audit-dot { width: 8px; height: 8px; margin-top: 4px; border-radius: 50%; background: var(--green-600); }
.audit-dot.warn { background: var(--gold-600); }
.audit-dot.danger { background: var(--coral-600); }
.audit-row strong, .audit-row span { display: block; }
.audit-row strong { font-size: 10px; }
.audit-row span, .audit-row time { color: var(--muted); font-size: 9px; }

.modal-backdrop { position: fixed; inset: 0; z-index: 80; display: grid; place-items: center; padding: 20px; background: rgba(7,31,24,.62); }
.modal { width: min(680px,100%); max-height: min(88vh,840px); display: grid; grid-template-rows: auto minmax(0,1fr); overflow: hidden; border-radius: 8px; background: white; box-shadow: 0 25px 75px rgba(8,34,26,.28); }
.modal-small { width: min(430px,100%); display: block; padding: 28px; text-align: center; }
.modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h2 { margin: 4px 0 3px; font-size: 20px; }
.modal-head p { margin: 0; color: var(--muted); font-size: 11px; }
#actionForm { min-height: 0; display: grid; grid-template-rows: minmax(0,1fr) auto; }
.modal-body { overflow-y: auto; padding: 19px 20px 5px; }
.modal-footer { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 20px; border-top: 1px solid var(--line); background: #fafcfb; }
.idle-icon { width: 48px; height: 48px; display: grid; place-items: center; margin: 0 auto 13px; border-radius: 50%; color: var(--gold-600); background: var(--gold-100); }
.idle-icon svg { width: 23px; height: 23px; }
.modal-small h2 { margin: 0 0 8px; font-size: 19px; }
.modal-small p { margin: 0 0 18px; color: var(--muted); font-size: 12px; }

.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; width: min(360px,calc(100vw - 36px)); display: grid; gap: 8px; }
.toast { display: grid; grid-template-columns: 20px minmax(0,1fr) auto; align-items: start; gap: 9px; padding: 12px; color: white; background: var(--green-900); border-radius: 6px; box-shadow: var(--shadow); font-size: 11px; }
.toast.error { background: #7d302b; }
.toast svg { width: 18px; height: 18px; }
.toast button { padding: 0; border: 0; color: inherit; background: transparent; }
.workspace-footer { display: flex; justify-content: space-between; gap: 15px; padding: 12px clamp(18px,2.5vw,34px) 24px; color: var(--muted); font-size: 9px; }
.mobile-overlay { display: none; }

@media (max-width: 1180px) {
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-layout, .case-layout { grid-template-columns: 1fr; }
  .record-list { max-height: 320px; }
  .section-grid.three, .appointment-grid, .system-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .pipeline { grid-template-columns: repeat(3,minmax(0,1fr)); }
}
@media (max-width: 900px) {
  .auth-layout { grid-template-columns: 1fr; }
  .auth-brand { display: none; }
  .app { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; transform: translateX(-100%); width: min(var(--sidebar-width),86vw); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close, .menu-button { display: inline-grid; }
  .mobile-overlay { position: fixed; inset: 0; z-index: 25; background: rgba(7,31,24,.48); }
  .mobile-overlay.show { display: block; }
  .global-search { width: min(430px,58vw); }
  .connection-pill, .profile-button > span:not(.avatar), .profile-button > svg { display: none; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .page-actions { justify-content: flex-start; }
}
@media (max-width: 640px) {
  .auth-form-side { padding: 14px; }
  .auth-panel { padding: 24px 20px; }
  .topbar { height: 62px; padding: 0 14px; }
  .global-search { width: calc(100vw - 148px); }
  .global-search kbd, .profile-button { display: none; }
  .page-heading, .view-region { padding-left: 14px; padding-right: 14px; }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); padding-left: 14px; padding-right: 14px; }
  .metric-card { min-height: 104px; grid-template-columns: minmax(0,1fr); }
  .metric-icon { display: none !important; }
  .metric-card strong { font-size: 24px; }
  .field-row, .lookup-row, .section-grid, .section-grid.three, .appointment-grid, .system-grid, .detail-strip { grid-template-columns: 1fr; }
  .detail-item { border-right: 0; border-bottom: 1px solid var(--line); }
  .detail-item:last-child { border-bottom: 0; }
  .filterbar, .filterbar.two { grid-template-columns: 1fr; }
  .currency-switch { width: 100%; flex-wrap: wrap; }
  .quick-actions { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .pipeline { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .case-hero { flex-direction: column; }
  .case-actions { justify-content: flex-start; }
  .modal-backdrop { padding: 10px; }
  .modal { max-height: 94vh; }
  .workspace-footer { flex-direction: column; padding-left: 14px; padding-right: 14px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
