@font-face { font-family: "Montserrat"; src: url("./fonts/Montserrat-Regular.ttf") format("truetype"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("./fonts/Montserrat-Medium.ttf") format("truetype"); font-weight: 500; font-style: normal; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("./fonts/Montserrat-SemiBold.ttf") format("truetype"); font-weight: 600; font-style: normal; font-display: swap; }
@font-face { font-family: "Montserrat"; src: url("./fonts/Montserrat-Bold.ttf") format("truetype"); font-weight: 700; font-style: normal; font-display: swap; }

:root {
  --ink: #101820;
  --ink-2: #18324a;
  --slate: #3f4d5a;
  --muted: #687684;
  --line: #c9d1d9;
  --line-dark: #7c8995;
  --paper: #ffffff;
  --canvas: #ffffff;
  --soft: #edf1f4;
  --soft-blue: #dfe8ef;
  --red: #b4232f;
  --red-soft: #fff0f1;
  --amber: #183b5b;
  --amber-soft: #e5ebf0;
  --green: #183b5b;
  --green-soft: #e5ebf0;
  --blue: #183b5b;
  --blue-soft: #e5ebf0;
  --shadow: 0 12px 28px rgba(16, 24, 32, .12);
  --radius: 14px;
}

* { box-sizing: border-box; }
html { background: var(--canvas); }
body {
  margin: 0;
  color: var(--ink);
  background: var(--canvas);
  font-family: "Montserrat", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.4;
}
button, select, input, textarea { font: inherit; }
button { cursor: pointer; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 252px minmax(0, 1fr);
  grid-template-rows: 72px 1fr;
  position: relative;
  z-index: 1;
}
body::before { content: ""; position: fixed; inset: 72px 0 0 252px; z-index: 0; pointer-events: none; background: url("./arrow-watermark.svg") center center / cover no-repeat; opacity: .13; }

.topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  color: #fff;
  background: var(--ink);
  border-bottom: 1px solid rgba(255,255,255,.12);
  position: sticky;
  top: 0;
  z-index: 30;
}
.brand { display: flex; align-items: center; gap: 13px; }
.brand-mark {
  width: 34px; height: 34px; border: 1px solid rgba(255,255,255,.55);
  position: relative; transform: rotate(45deg);
}
.brand-mark::after { content: ""; position: absolute; inset: 8px; border: 2px solid #fff; }
.brand div { display: flex; flex-direction: column; }
.brand strong { font-size: 17px; letter-spacing: .01em; }
.brand span { color: #aab7c5; font-size: 12px; }
.topbar-actions { display: flex; align-items: center; gap: 12px; }
.delegation-button { padding: 10px 14px; color: #fff; background: #183b5b; border: 1px solid #b6c5d2; border-radius: 9px; font-weight: 700; box-shadow: 0 0 0 2px rgba(255,255,255,.08); }
.delegation-button:hover { background: #234c70; }
.role-picker { display: flex; align-items: center; gap: 9px; }
.role-picker > span { color: #b9c3ce; font-size: 13px; }
.role-picker select {
  min-width: 250px;
  color: #fff; background: #1c3044;
  border: 1px solid #42576b; border-radius: 8px;
  padding: 9px 36px 9px 12px;
}
.icon-button {
  width: 40px; height: 40px; border-radius: 8px;
  color: #fff; background: #1c3044; border: 1px solid #42576b;
}
.notification-button { position: relative; color: #f4b44a; }
.notification-button b {
  position: absolute; right: -5px; top: -6px; min-width: 18px; height: 18px;
  border-radius: 9px; padding: 0 5px; display: grid; place-items: center;
  font-size: 11px; background: var(--red); color: #fff;
}
.avatar {
  width: 38px; height: 38px; border-radius: 50%; display: grid; place-items: center;
  background: #dfe8f0; color: var(--ink); font-weight: 700; font-size: 13px;
}

.sidebar {
  grid-column: 1; grid-row: 2;
  display: flex; flex-direction: column;
  background: #fff; border-right: 1px solid var(--line);
  min-height: calc(100vh - 72px); position: sticky; top: 72px;
}
.scope { margin: 24px 20px 16px; padding: 14px; background: var(--soft); border-left: 3px solid var(--blue); }
.scope span, .scope small { display: block; font-size: 12px; color: var(--slate); }
.scope strong { display: block; margin: 4px 0; font-size: 14px; }
#sideNav { padding: 0 12px; }
.create-area { position: relative; padding: 0 12px 12px; }
.create-document-button { width: 100%; border: 0; border-radius: 9px; padding: 12px 13px; background: var(--blue); color: #fff; font-weight: 700; text-align: left; }
.create-document-button span { font-size: 18px; margin-right: 7px; }
.create-menu { position: absolute; left: 12px; right: 12px; top: 52px; z-index: 45; padding: 7px; background: #fff; border: 1px solid var(--line-dark); border-radius: 10px; box-shadow: var(--shadow); }
.create-menu button { width: 100%; border: 0; background: transparent; color: var(--ink); padding: 9px 10px; border-radius: 7px; text-align: left; font-size: 13px; }
.create-menu button:hover { background: var(--soft); }
.create-menu .menu-section { display: block; padding: 7px 10px 3px; color: var(--muted); font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.nav-button {
  width: 100%; display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; margin: 2px 0; border: 0; border-radius: 8px;
  color: var(--slate); background: transparent; text-align: left;
}
.nav-button span:first-child { width: 22px; color: var(--muted); text-align: center; }
.nav-button:hover { background: var(--canvas); color: var(--ink); }
.nav-button.active { background: var(--ink); color: #fff; }
.nav-button b { margin-left: auto; min-width: 22px; padding: 2px 6px; border-radius: 9px; background: var(--blue); color: #fff; font-size: 11px; text-align: center; }
.sidebar-footer { margin-top: auto; padding: 18px 20px 24px; display: flex; gap: 10px; border-top: 1px solid var(--line); }
.sidebar-footer div:last-child { display: flex; flex-direction: column; }
.sidebar-footer strong { font-size: 12px; }
.sidebar-footer span { font-size: 11px; color: var(--muted); }
.sync-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); margin-top: 4px; box-shadow: 0 0 0 4px var(--green-soft); }

.main-content { grid-column: 2; grid-row: 2; padding: 26px 30px 46px; min-width: 0; background: rgba(255,255,255,.83); }
.page-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; margin-bottom: 20px; }
.eyebrow { display: block; text-transform: uppercase; letter-spacing: .13em; font-size: 11px; color: var(--muted); font-weight: 700; }
.page-header h1 { margin: 4px 0 4px; font-size: 29px; line-height: 1.15; font-weight: 600; }
.page-header p { margin: 0; color: var(--slate); }
.header-actions { display: flex; align-items: center; gap: 9px; }
.delegation-header-button { color: #fff; background: var(--blue); border: 1px solid var(--blue); border-radius: 8px; padding: 9px 14px; font-weight: 700; white-space: nowrap; }
.delegation-header-button:hover { background: #234c70; }
.filter-select { color: var(--ink-2); background: #fff; border: 1px solid var(--line-dark); border-radius: 8px; padding: 9px 34px 9px 11px; }
.primary-button, .secondary-button, .danger-button, .ghost-button {
  border-radius: 8px; padding: 9px 14px; font-weight: 700; border: 1px solid transparent;
}
.primary-button { color: #fff; background: var(--ink); }
.secondary-button { color: var(--ink); background: #fff; border-color: var(--line-dark); }
.danger-button { color: #fff; background: var(--red); }
.ghost-button { color: var(--blue); background: var(--blue-soft); }
.full { width: 100%; margin-top: 10px; }
.small-button { padding: 6px 9px; font-size: 13px; }

.kpi-grid { display: grid; grid-template-columns: repeat(5, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi-card, .panel {
  background: #fff; border: 1px solid #aeb8c2; border-radius: var(--radius);
}
.kpi-card { padding: 16px; min-height: 118px; position: relative; overflow: hidden; }
.kpi-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--blue); }
.kpi-card.risk::before { background: var(--red); }
.kpi-card.good::before, .kpi-card.warn::before { background: var(--blue); }
.kpi-card span { display: block; color: var(--slate); font-size: 13px; min-height: 36px; }
.kpi-card strong { display: block; margin: 5px 0 2px; font-size: 28px; line-height: 1; }
.kpi-card small { color: var(--muted); font-size: 12px; }
.delta-up { color: var(--green)!important; }
.delta-down { color: var(--red)!important; }

.dashboard-grid { display: grid; grid-template-columns: 1.25fr .9fr; gap: 14px; margin-top: 14px; }
.dashboard-grid.equal { grid-template-columns: 1fr 1fr; }
.panel { padding: 17px; min-width: 0; }
.executor-form-panel { padding-top: 0; overflow: hidden; }
.executor-context-bar { margin: 0 -17px 15px; padding: 13px 17px; color: #fff; background: var(--ink); font-weight: 700; }
.panel.wide { grid-column: 1 / -1; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.panel-header h2 { margin: 0; font-size: 17px; }
.panel-header p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.panel-link { border: 0; background: transparent; color: var(--blue); font-size: 13px; }

.efficiency-list { display: grid; gap: 13px; }
.efficiency-row { display: grid; grid-template-columns: 130px 1fr 44px; align-items: center; gap: 10px; }
.efficiency-row button { border: 0; background: none; padding: 0; color: var(--ink); text-align: left; font-weight: 700; }
.bar-track { height: 12px; background: var(--soft); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 6px; background: var(--blue); }
.bar-fill.good, .bar-fill.warn { background: var(--blue); }
.bar-fill.risk { background: var(--red); }
.efficiency-row strong { text-align: right; }
.metric-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 16px; color: var(--muted); font-size: 12px; }
.metric-legend i { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; }

.donut-wrap { display: flex; align-items: center; gap: 24px; }
.donut { width: 142px; height: 142px; border-radius: 50%; display: grid; place-items: center; position: relative; background: conic-gradient(var(--blue) 0 64%, var(--red) 64% 72%, var(--soft) 72%); }
.donut::after { content: ""; width: 88px; height: 88px; border-radius: 50%; background: #fff; position: absolute; }
.donut strong { z-index: 1; font-size: 24px; }
.donut-legend { display: grid; gap: 9px; flex: 1; }
.donut-legend div { display: flex; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.donut-legend span { color: var(--slate); }

.table-wrap { overflow-x: auto; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { padding: 10px 11px; color: #fff; background: var(--ink); text-align: left; font-size: 12px; letter-spacing: .01em; }
.data-table td { padding: 10px 11px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.data-table tbody tr { transition: background .15s; }
.data-table tbody tr.clickable:hover { background: var(--blue-soft); cursor: pointer; }
.editable-table input, .editable-table select { width: 100%; min-width: 72px; padding: 7px 8px; border: 1px solid var(--line-dark); border-radius: 5px; background: #fff; color: var(--ink); }
.editable-table td:first-child { min-width: 235px; }
.editable-table td:nth-child(6) { min-width: 155px; }
.editable-table td:nth-child(7) { min-width: 140px; }
.editable-table td:nth-child(8) { min-width: 210px; }
.executor-form-footer { display: grid; grid-template-columns: 1fr auto auto; gap: 18px; align-items: center; margin-top: 14px; padding: 12px 14px; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.executor-form-footer > div { display: flex; gap: 9px; }
.mobile-entry-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin-top: 10px; }
.mobile-entry-grid label { color: var(--slate); font-size: 12px; }
.mobile-entry-grid input, .mobile-entry-grid select { width: 100%; margin-top: 3px; padding: 9px; border: 1px solid var(--line-dark); border-radius: 7px; background: #fff; }
.mobile-entry-grid .wide { grid-column: 1 / -1; }
.subtle { color: var(--muted); font-size: 12px; }
.strong { font-weight: 700; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; padding: 4px 8px; border-radius: 11px; font-size: 12px; font-weight: 700; }
.status-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-pill.green { color: #fff; background: var(--blue); }
.status-pill.red { color: var(--red); background: var(--red-soft); }
.status-pill.amber, .status-pill.blue { color: #fff; background: var(--blue); }
.status-pill.gray { color: var(--slate); background: var(--soft); }

.gantt { border: 1px solid var(--line); border-radius: 10px; overflow-x: auto; }
.gantt-head, .gantt-row { display: grid; grid-template-columns: 118px 150px 82px 210px repeat(8, minmax(54px, 1fr)); min-width: 1120px; min-height: 42px; }
.gantt-head { background: var(--ink); color: #fff; font-size: 11px; }
.gantt-head > div, .gantt-row > div { padding: 10px 7px; border-right: 1px solid rgba(215,224,233,.65); position: relative; }
.gantt-row { border-top: 1px solid var(--line); background: #fff; font-size: 13px; }
.gantt-row:hover { background: #f8fafc; }
.gantt-label { font-weight: 700; }
.gantt-project, .gantt-milestone { line-height: 1.25; }
.gantt-milestone { color: var(--slate); font-size: 11px; }
.gantt-code { color: var(--blue); }
.gantt-bar { position: absolute!important; height: 18px; top: 10px; z-index: 2; padding: 2px 7px!important; border: 0!important; border-radius: 4px; color: #fff; font-size: 10px; white-space: nowrap; overflow: hidden; }
.gantt-bar.blue { background: var(--blue); }
.gantt-bar.red { background: var(--red); }
.gantt-bar.green, .gantt-bar.amber { background: var(--blue); }

.heatmap { display: grid; grid-template-columns: 140px repeat(4, 1fr); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.heatmap > div { min-height: 46px; padding: 9px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); font-size: 12px; }
.heatmap .head { background: var(--ink); color: #fff; font-weight: 700; }
.heatmap .risk-1 { background: #fff; color: var(--ink); }
.heatmap .risk-2 { background: var(--blue-soft); color: var(--blue); }
.heatmap .risk-3 { background: #fde4e6; color: var(--red); font-weight: 700; }

.role-banner { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; margin-bottom: 14px; background: var(--ink); color: #fff; border-radius: 12px; }
.role-banner p { margin: 3px 0 0; color: #bac5d0; font-size: 13px; }
.identity-tabs { display: flex; gap: 6px; }
.identity-tabs button { border: 1px solid #526679; color: #c8d1d9; background: #1b3044; border-radius: 7px; padding: 7px 11px; }
.identity-tabs button.active { color: var(--ink); background: #fff; border-color: #fff; font-weight: 700; }

.task-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.task-card { padding: 15px; background: #fff; border: 1px solid var(--line); border-radius: 12px; position: relative; }
.task-card:hover { border-color: #9eb3c7; box-shadow: 0 8px 18px rgba(15,29,43,.08); }
.task-card .task-top { display: flex; justify-content: space-between; gap: 8px; }
.task-card h3 { margin: 8px 0 5px; font-size: 16px; }
.task-card p { margin: 0; color: var(--slate); font-size: 13px; }
.task-card .progress-line { margin: 14px 0 10px; }
.progress-meta { display: flex; justify-content: space-between; margin-bottom: 5px; font-size: 12px; }
.task-card footer { display: flex; align-items: center; justify-content: space-between; border-top: 1px solid var(--line); padding-top: 10px; margin-top: 11px; }
.task-card footer button { border: 0; background: none; color: var(--blue); font-weight: 700; }

.workload { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; align-items: end; min-height: 180px; }
.workload-col { display: grid; grid-template-rows: 1fr auto; gap: 8px; height: 170px; text-align: center; }
.workload-bar-wrap { display: flex; align-items: flex-end; justify-content: center; gap: 5px; border-bottom: 1px solid var(--line-dark); }
.workload-bar { width: 28px; background: var(--blue); border-radius: 5px 5px 0 0; position: relative; }
.workload-bar.over { background: var(--red); }
.workload-bar span { position: absolute; top: -20px; left: 50%; transform: translateX(-50%); font-size: 11px; font-weight: 700; }
.workload-col small { color: var(--slate); }

.document-modal { width: min(1100px, calc(100vw - 70px)); height: min(760px, calc(100vh - 50px)); background: #fff; border-radius: 16px; box-shadow: var(--shadow); display: grid; grid-template-rows: auto auto 1fr; overflow: hidden; }
.modal-backdrop { position: fixed; inset: 0; z-index: 70; display: grid; place-items: center; background: rgba(7,18,28,.62); backdrop-filter: blur(2px); }
.hidden { display: none!important; }
.modal-header { display: flex; justify-content: space-between; gap: 20px; padding: 22px 24px 17px; border-bottom: 1px solid var(--line); }
.modal-header h2 { margin: 4px 0; font-size: 23px; }
.modal-header p { margin: 0; color: var(--slate); }
.modal-close, .owner-panel header button { width: 36px; height: 36px; border: 0; border-radius: 8px; background: var(--soft); font-size: 26px; color: var(--ink); }
.modal-tabs { display: flex; padding: 0 24px; border-bottom: 1px solid var(--line); }
.modal-tab { padding: 13px 15px 11px; border: 0; border-bottom: 3px solid transparent; color: var(--slate); background: transparent; }
.modal-tab.active { color: var(--ink); border-color: var(--blue); font-weight: 700; }
.modal-tab b { margin-left: 5px; padding: 2px 6px; border-radius: 8px; background: var(--blue-soft); color: var(--blue); font-size: 10px; }
.modal-body { padding: 20px 24px 26px; overflow: auto; background: #fbfcfd; }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.detail-field { padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 9px; }
.detail-field label { display: block; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 5px; }
.detail-field strong { font-size: 14px; }
.detail-field.wide { grid-column: span 2; }
.action-box { margin-top: 14px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.action-box h3 { margin: 0 0 10px; font-size: 15px; }
.form-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.form-grid label, .message-form label { color: var(--slate); font-size: 12px; }
.form-grid input, .form-grid select, .form-grid textarea, .message-form textarea, .invite-form select {
  width: 100%; margin-top: 4px; padding: 9px 10px; border: 1px solid var(--line-dark); border-radius: 7px; background: #fff; color: var(--ink);
}
.form-grid textarea { min-height: 74px; resize: vertical; }
.form-grid .span-2 { grid-column: span 2; }
.plan-create-note { display: flex; flex-direction: column; gap: 4px; padding: 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--blue-soft); color: var(--ink); }
.plan-create-note span { color: var(--slate); font-size: 12px; }
.responsible-card { display: grid; grid-template-columns: 1fr 1.4fr; gap: 14px; align-items: end; padding: 13px; border: 1px solid var(--line-dark); border-radius: 10px; background: #f7f9fb; }
.responsible-card > div:first-child { display: flex; flex-direction: column; gap: 4px; }
.responsible-card span { color: var(--muted); font-size: 12px; }
.responsible-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 11px; }
.plan-editor { overflow-x: auto; }
.plan-editor .panel-header { min-width: 840px; }
.plan-table { min-width: 920px; border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.plan-head, .plan-row { display: grid; align-items: stretch; border-bottom: 1px solid var(--line); }
.plan-head { color: #fff; background: var(--ink); font-size: 11px; font-weight: 700; }
.plan-row:last-child { border-bottom: 0; }
.vpg-table .plan-head, .vpg-table .plan-row { grid-template-columns: 58px 2fr 1fr 105px 105px 1.5fr; }
.dpg-table { min-width: 1840px; }
.dpg-table .plan-head, .dpg-table .plan-row { grid-template-columns: 200px 72px 1.45fr 125px 145px 82px 102px 102px 115px 1.3fr 68px 135px; }
.plan-head span { padding: 9px 7px; border-right: 1px solid rgba(255,255,255,.18); }
.plan-row input, .plan-row select { min-width: 0; width: 100%; padding: 9px 7px; border: 0; border-right: 1px solid var(--line); background: #fff; color: var(--ink); }
.plan-row input:focus, .plan-row select:focus { position: relative; z-index: 1; outline: 2px solid var(--blue); outline-offset: -2px; }
.plan-row input:disabled, .plan-row select:disabled { color: var(--ink); background: #f7f9fb; opacity: 1; }
.dpg-table .plan-row input:first-child { background: var(--blue-soft); color: var(--blue); font-weight: 700; }
.mini-gantt { position: relative; min-height: 38px; background: repeating-linear-gradient(90deg,#fff 0,#fff calc(25% - 1px),var(--line) 25%); overflow: hidden; }
.mini-gantt span { position: absolute; top: 9px; height: 20px; padding: 2px 6px; border-radius: 4px; color: #fff; background: var(--blue); font-size: 10px; white-space: nowrap; }
.route-summary { display: flex; justify-content: space-between; gap: 16px; margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--line-dark); border-left: 4px solid var(--blue); border-radius: 9px; background: #fff; }
.route-summary span { color: var(--slate); font-size: 13px; text-align: right; }
.create-modal-shell { height: min(790px, calc(100vh - 38px)); grid-template-rows: auto 1fr; }
.route-builder { margin-top: 16px; padding: 15px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.route-builder h3 { margin: 0 0 4px; font-size: 16px; }
.route-builder > p { margin: 0 0 12px; color: var(--muted); font-size: 12px; }
.route-controls { display: grid; grid-template-columns: minmax(220px,1fr) repeat(3, auto); gap: 8px; align-items: end; }
.route-controls select { width: 100%; padding: 9px 10px; border: 1px solid var(--line-dark); border-radius: 7px; background: #fff; }
.route-groups { display: grid; gap: 10px; margin-top: 12px; }
.route-group { display: grid; grid-template-columns: 170px 1fr; gap: 10px; align-items: start; padding-top: 10px; border-top: 1px solid var(--line); }
.route-group strong { font-size: 12px; }
.person-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.person-chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 8px; border-radius: 12px; background: var(--soft); font-size: 11px; }
.person-chip button { border: 0; background: none; padding: 0; color: var(--ink); font-weight: 700; }
.delegation-modal-shell { width: min(720px, calc(100vw - 28px)); height: auto; max-height: calc(100vh - 40px); }
.delegation-current { display: grid; gap: 3px; margin-bottom: 14px; padding: 13px; color: #fff; background: var(--blue); border-radius: 10px; }
.delegation-current span, .delegation-current small { color: #dce7ef; }
.delegation-list { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); }
.delegation-list h3 { margin: 0 0 9px; font-size: 15px; }
.delegation-row { display: flex; justify-content: space-between; gap: 14px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; }
.delegation-row div { display: flex; flex-direction: column; }
.delegation-row span { color: var(--muted); font-size: 12px; }
.delegation-scope { margin: 14px 0; padding: 12px; border: 1px solid var(--line-dark); border-radius: 10px; }
.delegation-scope legend { padding: 0 6px; font-weight: 700; }
.delegation-mode { display: flex; align-items: flex-start; gap: 10px; padding: 9px; border-radius: 8px; }
.delegation-mode:hover { background: var(--soft); }
.delegation-mode input { margin-top: 4px; }
.delegation-mode span { display: grid; gap: 2px; }
.delegation-mode small { color: var(--muted); }
.delegation-processes { display: none; grid-template-columns: repeat(2, minmax(0,1fr)); gap: 8px; margin: 8px 0 0 30px; }
.delegation-processes.active { display: grid; }
.delegation-processes label { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
.approver-switch { display: flex; align-items: flex-end; gap: 14px; }
.approver-switch label { display: grid; gap: 4px; color: var(--muted); font-size: 11px; }
.document-list { display: grid; gap: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.document-row { display: grid; grid-template-columns: 160px 1.4fr 1fr 130px 120px; gap: 12px; align-items: center; padding: 12px; background: #fff; border-bottom: 1px solid var(--line); }
.document-row:last-child { border-bottom: 0; }
.document-row:hover { background: #f8fafc; }
.document-row button { border: 0; background: none; color: var(--blue); font-weight: 700; text-align: left; }
.mobile-work-list { display: none; }
.mobile-work-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.mobile-work-item:last-child { border-bottom: 0; }
.mobile-work-item header { display: flex; justify-content: space-between; gap: 8px; }
.mobile-work-item h3 { margin: 4px 0; font-size: 15px; }
.mobile-work-item p { margin: 3px 0; color: var(--slate); font-size: 13px; }
.mobile-work-item button { width: 100%; margin-top: 8px; }

.chat-layout { display: grid; grid-template-columns: minmax(0, 1fr) 265px; gap: 15px; min-height: 480px; }
.chat-column { display: flex; flex-direction: column; min-width: 0; }
.messages { display: grid; align-content: start; gap: 10px; margin-bottom: 14px; }
.message { display: grid; grid-template-columns: 36px 1fr; gap: 9px; }
.message-avatar { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 50%; background: var(--soft-blue); color: var(--ink); font-size: 11px; font-weight: 700; }
.message-bubble { padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: 4px 11px 11px 11px; }
.message-head { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.message-head strong { font-size: 13px; }
.message-head span { color: var(--muted); font-size: 11px; }
.message-text { white-space: pre-wrap; font-size: 14px; }
.message-actions { margin-top: 6px; }
.message-actions button { border: 0; background: none; color: var(--blue); padding: 0; font-size: 11px; }
.system-event { display: flex; gap: 8px; align-items: flex-start; margin: 2px 0; padding: 8px 10px; border-left: 3px solid var(--blue); background: var(--blue-soft); color: var(--ink-2); font-size: 12px; }
.system-event.red { border-color: var(--red); background: var(--red-soft); }
.message-form { margin-top: auto; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.message-form textarea { min-height: 74px; resize: vertical; }
.message-form footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 8px; }
.message-tools { color: var(--muted); font-size: 12px; }
.participants { padding: 13px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.participants h3 { margin: 0 0 10px; font-size: 14px; }
.participant { display: grid; grid-template-columns: 30px 1fr; gap: 8px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.participant:last-of-type { border-bottom: 0; }
.participant .message-avatar { width: 30px; height: 30px; }
.participant strong { display: block; font-size: 12px; }
.participant span { color: var(--muted); font-size: 11px; }
.invite-form { margin-top: 12px; padding-top: 10px; border-top: 1px solid var(--line); }
.invite-form button { width: 100%; margin-top: 8px; }

.approval-route { display: grid; gap: 10px; }
.approval-step { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 11px; padding: 12px; background: #fff; border: 1px solid var(--line); border-radius: 10px; }
.approval-step .step-number { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--soft); font-weight: 700; }
.approval-step h4 { margin: 0; font-size: 14px; }
.approval-step p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.approval-buttons { display: flex; gap: 7px; }
.history-list { display: grid; gap: 0; }
.history-item { display: grid; grid-template-columns: 120px 18px 1fr; gap: 10px; min-height: 64px; }
.history-time { color: var(--muted); font-size: 11px; text-align: right; padding-top: 3px; }
.history-line { position: relative; }
.history-line::before { content: ""; position: absolute; left: 8px; top: 15px; bottom: -8px; width: 1px; background: var(--line-dark); }
.history-line::after { content: ""; position: absolute; left: 4px; top: 5px; width: 9px; height: 9px; border-radius: 50%; background: var(--blue); }
.history-item:last-child .history-line::before { display: none; }
.history-content { padding-bottom: 14px; }
.history-content strong { display: block; font-size: 13px; }
.history-content p { margin: 3px 0; color: var(--slate); font-size: 12px; }
.before-after { display: inline-flex; gap: 7px; padding: 4px 7px; background: var(--soft); border-radius: 5px; font-size: 11px; }
.before-after b { color: var(--red); }

.owner-panel { position: fixed; top: 0; right: 0; bottom: 0; width: 430px; z-index: 90; background: #fff; box-shadow: -18px 0 48px rgba(15,29,43,.2); transform: translateX(100%); transition: transform .25s ease; }
.owner-panel.open { transform: translateX(0); }
.owner-panel header { display: flex; justify-content: space-between; align-items: flex-start; padding: 23px; color: #fff; background: var(--ink); }
.owner-panel header h2 { margin: 5px 0 0; font-size: 21px; }
.owner-panel header button { color: #fff; background: #1d3348; }
.owner-panel-body { padding: 20px 23px; }
.owner-status { display: flex; gap: 11px; padding: 13px; border: 1px solid var(--line); border-radius: 10px; }
.owner-status p { margin: 3px 0 0; color: var(--muted); font-size: 12px; }
.status-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; background: var(--muted); }
.status-dot.success { background: var(--green); box-shadow: 0 0 0 4px var(--green-soft); }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 0; border-bottom: 1px solid var(--line); }
.switch-row span { display: flex; flex-direction: column; }
.switch-row small { color: var(--muted); margin-top: 3px; }
.switch-row input { display: none; }
.switch-row i { width: 44px; height: 24px; border-radius: 12px; background: var(--line-dark); position: relative; transition: .2s; }
.switch-row i::after { content: ""; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; transition: .2s; }
.switch-row input:checked + i { background: var(--green); }
.switch-row input:checked + i::after { transform: translateX(20px); }
.panel-scrim { position: fixed; inset: 0; z-index: 80; background: rgba(15,29,43,.38); }
.audit-preview { margin-top: 13px; max-height: 330px; overflow: auto; border: 1px solid var(--line); border-radius: 8px; }
.audit-row { padding: 9px 10px; border-bottom: 1px solid var(--line); font-size: 12px; }
.audit-row:last-child { border-bottom: 0; }
.audit-row span { display: block; color: var(--muted); font-size: 10px; }
.toast-container { position: fixed; right: 22px; bottom: 22px; z-index: 120; display: grid; gap: 8px; }
.toast { width: 340px; padding: 12px 14px; color: #fff; background: var(--ink); border-left: 4px solid var(--green); border-radius: 8px; box-shadow: var(--shadow); animation: toast-in .2s ease; }
.toast.error { border-color: var(--red); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

@media (max-width: 1250px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .task-cards { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .app-shell { width: 100%; min-width: 0; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto 1fr; }
  body::before { inset: 130px 0 0; background-size: auto 70%; opacity: .10; }
  .topbar { position: relative; padding: 12px 16px; gap: 14px; flex-wrap: wrap; }
  .brand span { display: none; }
  .topbar-actions { margin-left: auto; }
  .role-picker > span, .notification-button { display: none; }
  .delegation-button { padding: 8px 10px; font-size: 12px; }
  .role-picker select { min-width: 190px; max-width: 230px; }
  .sidebar { grid-column: 1; grid-row: 2; position: relative; top: 0; min-height: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .scope, .sidebar-footer { display: none; }
  .create-area { padding: 8px 12px 0; }
  .create-document-button { width: auto; }
  .create-menu { left: 12px; right: auto; width: min(360px, calc(100vw - 24px)); top: 54px; }
  #sideNav { display: flex; gap: 6px; padding: 8px 12px 10px; overflow-x: auto; }
  .nav-button { width: auto; flex: 0 0 auto; margin: 0; padding: 9px 11px; }
  .main-content { grid-column: 1; grid-row: 3; padding: 20px 16px 40px; }
  .page-header { align-items: flex-start; flex-direction: column; }
  .page-header h1 { font-size: 25px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .dashboard-grid, .dashboard-grid.equal { grid-template-columns: 1fr; }
  .task-cards { grid-template-columns: 1fr; }
  .panel.wide { grid-column: 1; }
  .gantt { min-width: 0; }
  .panel:has(.gantt) { overflow-x: auto; }
  .document-modal { width: calc(100vw - 24px); height: calc(100vh - 24px); }
  .chat-layout { grid-template-columns: 1fr; }
  .participants { order: -1; }
  .detail-grid, .form-grid { grid-template-columns: repeat(2, 1fr); }
  .owner-panel { width: min(430px, 100vw); }
  .desktop-work-table { display: none; }
  .mobile-work-list { display: block; }
  .document-row { grid-template-columns: 1fr; gap: 4px; }
  .route-controls { grid-template-columns: 1fr 1fr; }
  .route-controls label { grid-column: 1 / -1; }
  .route-group { grid-template-columns: 1fr; }
  .responsible-card { grid-template-columns: 1fr; }
  .approver-switch { width: 100%; align-items: stretch; flex-direction: column; }
  .executor-form-footer { grid-template-columns: 1fr; }
  .executor-form-footer > div { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 560px) {
  .topbar { align-items: flex-start; }
  .brand strong { font-size: 14px; }
  .brand-mark { width: 28px; height: 28px; }
  .topbar .delegation-button { display: none; }
  .topbar-actions { width: 100%; margin-left: 0; display: grid; grid-template-columns: minmax(0,1fr) auto; }
  .role-picker, .role-picker select { width: 100%; min-width: 0; }
  .role-picker select { font-size: 13px; }
  .avatar { display: none; }
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .kpi-card { min-height: 104px; padding: 13px; }
  .kpi-card strong { font-size: 23px; }
  .panel { padding: 14px; border-radius: 10px; }
  .panel-header { flex-direction: column; }
  .panel-header > button { align-self: flex-start; }
  .executor-context-bar { margin: 0 -14px 14px; padding: 12px 14px; }
  .page-header h1 { font-size: 23px; }
  .header-actions { width: 100%; flex-wrap: wrap; }
  .delegation-header-button { width: 100%; }
  .filter-select { flex: 1; min-width: 150px; }
  .detail-grid, .form-grid { grid-template-columns: 1fr; }
  .responsible-grid { grid-template-columns: 1fr; }
  .delegation-row { flex-direction: column; }
  .delegation-processes { grid-template-columns: 1fr; margin-left: 0; }
  .detail-field.wide, .form-grid .span-2 { grid-column: 1; }
  .modal-header { padding: 16px; }
  .modal-body { padding: 14px; }
  .modal-tabs { padding: 0 10px; overflow-x: auto; }
  .modal-tab { white-space: nowrap; padding: 11px 10px; font-size: 13px; }
}
