/* DT Yönetim — arayüz stilleri */
:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --surface-2: #f9fafb;
  --text: #15171c;
  --muted: #6b7280;
  --border: #e4e7ec;
  --border-strong: #cfd4dc;
  --primary: #e8590c;
  --primary-hover: #cf4f0a;
  --primary-soft: #fff1e8;
  --primary-ink: #ffffff;
  --sidebar: #14161b;
  --sidebar-2: #1c1f26;
  --sidebar-text: #b9bfc9;
  --sidebar-active: #ffffff;
  --success: #15803d;
  --danger: #c62828;
  --warning: #b45309;
  --radius: 10px;
  --radius-sm: 7px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 1px 3px rgba(16, 24, 40, .06);
  --shadow-lg: 0 12px 32px rgba(16, 24, 40, .14);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --sidebar-w: 264px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font-family: var(--font); font-size: 14.5px; line-height: 1.5; color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: inherit; text-decoration: none; }
a.link, .prose a { color: var(--primary); }
a.link:hover, .prose a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 22px; font-weight: 650; letter-spacing: -.01em; }
h2 { font-size: 16px; font-weight: 650; }
h3 { font-size: 14px; font-weight: 650; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.center { text-align: center; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pos { color: var(--success); }
.neg { color: var(--danger); }
.hidden { display: none !important; }
svg.i { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }
svg.i.sm { width: 15px; height: 15px; }
svg.i.lg { width: 22px; height: 22px; }

/* ---------- layout ---------- */
.app { display: flex; min-height: 100vh; }
.sidebar { width: var(--sidebar-w); background: var(--sidebar); color: var(--sidebar-text); position: fixed; inset: 0 auto 0 0; display: flex; flex-direction: column; z-index: 40; transition: transform .2s ease; }
.sidebar .brand { padding: 18px 20px 14px; display: flex; align-items: center; justify-content: center; border-bottom: 1px solid rgba(255,255,255,.06); }
.sidebar .brand img { height: 42px; width: auto; }
.sidebar nav { flex: 1; overflow-y: auto; padding: 10px 10px 16px; scrollbar-width: thin; scrollbar-color: #333 transparent; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 7px; color: var(--sidebar-text); font-size: 13.8px; }
.nav-item:hover { background: var(--sidebar-2); color: #fff; }
.nav-item.active { background: rgba(232, 89, 12, .16); color: var(--sidebar-active); }
.nav-item.active svg { color: var(--primary); }
.nav-group { margin-top: 6px; }
.nav-group > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 8px; padding: 8px 10px 6px; font-size: 11.5px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: #7d8592; border-radius: 6px; user-select: none; }
.nav-group > summary::-webkit-details-marker { display: none; }
.nav-group > summary:hover { color: #c8cdd5; }
.nav-group > summary .chev { margin-left: auto; transition: transform .15s; width: 14px; height: 14px; }
.nav-group[open] > summary .chev { transform: rotate(90deg); }
.nav-group .nav-item { padding-left: 14px; }
.nav-ai { margin: 4px 0 8px; background: linear-gradient(135deg, rgba(232,89,12,.22), rgba(232,89,12,.08)); color: #fff; border: 1px solid rgba(232,89,12,.35); }
.nav-ai:hover { background: rgba(232,89,12,.3); }
.sidebar .foot { border-top: 1px solid rgba(255,255,255,.06); padding: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; }
.avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: grid; place-items: center; font-weight: 650; font-size: 13px; flex: none; }
.user-chip .who { line-height: 1.2; min-width: 0; }
.user-chip .who b { color: #fff; font-weight: 600; font-size: 13.5px; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip .who span { font-size: 12px; color: #858c98; }
.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 30; background: rgba(244,245,247,.9); backdrop-filter: blur(8px); border-bottom: 1px solid var(--border); height: 58px; display: flex; align-items: center; gap: 12px; padding: 0 24px; }
.topbar .menu-btn { display: none; }
.gsearch { position: relative; flex: 1; max-width: 460px; }
.gsearch input { width: 100%; padding: 8px 12px 8px 36px; border: 1px solid var(--border); border-radius: 9px; background: var(--surface); font: inherit; }
.gsearch input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.gsearch > svg { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.gsearch .results { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); max-height: 70vh; overflow: auto; padding: 6px; }
.gsearch .results .grp { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; padding: 8px 10px 4px; }
.gsearch .results a { display: block; padding: 7px 10px; border-radius: 7px; }
.gsearch .results a:hover, .gsearch .results a.sel { background: var(--surface-2); }
.topbar .spacer { flex: 1; }
.content { padding: 24px; max-width: 1480px; width: 100%; margin: 0 auto; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); font: inherit; font-weight: 550; font-size: 13.8px; cursor: pointer; white-space: nowrap; line-height: 1.25; transition: background .12s, border-color .12s; }
.btn:hover { background: var(--surface-2); border-color: #b9c0ca; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { color: var(--danger); border-color: #f1c4c4; }
.btn-danger:hover { background: #fdf0f0; border-color: #e7a3a3; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,.05); border-color: transparent; }
.btn-sm { padding: 5px 10px; font-size: 13px; border-radius: 7px; }
.btn-icon { padding: 7px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- cards / page ---------- */
.page-head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head h1 { margin-right: auto; }
.page-head .sub { width: 100%; margin-top: -8px; color: var(--muted); font-size: 13.5px; }
.crumbs { font-size: 13px; color: var(--muted); margin-bottom: 6px; display: flex; gap: 6px; align-items: center; }
.crumbs a:hover { color: var(--text); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; margin-bottom: 18px; }
.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.card-head h2 { margin-right: auto; display: flex; align-items: center; gap: 8px; }
.card.flush { padding: 0; overflow: hidden; }
.card.flush .card-head { padding: 14px 18px 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
.grid-2 > .card, .grid-3 > .card { margin-bottom: 0; }
.stack > * + * { margin-top: 18px; }
.empty { text-align: center; padding: 34px 16px; color: var(--muted); }
.empty svg { width: 34px; height: 34px; color: #c3c8d0; margin-bottom: 6px; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 15px 16px; box-shadow: var(--shadow); display: flex; gap: 12px; align-items: flex-start; }
.stat .ico { width: 38px; height: 38px; border-radius: 9px; display: grid; place-items: center; background: var(--primary-soft); color: var(--primary); flex: none; }
.stat .ico.green { background: #e9f7ee; color: var(--success); }
.stat .ico.red { background: #fdecec; color: var(--danger); }
.stat .ico.blue { background: #eaf1fe; color: #2563eb; }
.stat .lbl { font-size: 12.5px; color: var(--muted); }
.stat .val { font-size: 19px; white-space: nowrap; font-weight: 650; letter-spacing: -.01em; font-variant-numeric: tabular-nums; line-height: 1.3; }
.stat .sub { font-size: 12px; color: var(--muted); }

/* ---------- table ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.8px; }
.table th { text-align: left; font-weight: 600; font-size: 12.3px; color: var(--muted); padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--surface-2); white-space: nowrap; }
.table th a { display: inline-flex; gap: 4px; align-items: center; }
.table th a:hover { color: var(--text); }
.table td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:hover { background: #fafbfc; }
.table tbody tr.clickable { cursor: pointer; }
.table tfoot td { font-weight: 650; background: var(--surface-2); border-bottom: 0; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table.compact td, .table.compact th { padding: 6px 10px; }
.card.flush .table th:first-child, .card.flush .table td:first-child { padding-left: 18px; }
.card.flush .table th:last-child, .card.flush .table td:last-child { padding-right: 18px; }

/* ---------- badges ---------- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 550; background: #eef0f3; color: #3f4651; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .7; }
.badge.plain::before { display: none; }
.badge-gray { background: #eef0f3; color: #4b5260; }
.badge-blue { background: #e8f0fe; color: #1d4fd7; }
.badge-green { background: #e6f6ec; color: #13703a; }
.badge-red { background: #fdeaea; color: #b42323; }
.badge-orange { background: #fff0e5; color: #c2410c; }
.badge-amber { background: #fdf5dd; color: #946200; }
.badge-purple { background: #f1ebfe; color: #6b34c9; }
.badge-teal { background: #e2f6f3; color: #0f766e; }
.badge-cyan { background: #e0f5fa; color: #0e7490; }

/* ---------- forms ---------- */
.form-grid { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px 16px; }
.fld { grid-column: span 3; min-width: 0; }
.fld.w-third { grid-column: span 2; }
.fld.w-full { grid-column: span 6; }
.fld label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 5px; color: #2f343c; }
.fld label .req { color: var(--danger); margin-left: 2px; }
.fld .help { font-size: 12px; color: var(--muted); margin-top: 4px; }
.fld .err { font-size: 12.5px; color: var(--danger); margin-top: 4px; }
.fld.has-err .input { border-color: var(--danger); }
.input, select.input, textarea.input { width: 100%; padding: 8px 11px; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); background: var(--surface); font: inherit; color: var(--text); min-height: 38px; }
textarea.input { min-height: 84px; resize: vertical; }
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.input[readonly] { background: var(--surface-2); color: #4b5260; }
.input.money { text-align: right; font-variant-numeric: tabular-nums; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; padding-top: 7px; }
.check input { width: 18px; height: 18px; accent-color: var(--primary); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--border); }
.form-errors { background: #fdeaea; border: 1px solid #f3c2c2; color: #8f1d1d; border-radius: 8px; padding: 10px 14px; margin-bottom: 14px; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form .input { width: auto; min-width: 140px; }

/* multi select (refs) */
.ms { border: 1px solid var(--border-strong); border-radius: var(--radius-sm); padding: 5px; display: flex; flex-wrap: wrap; gap: 5px; min-height: 38px; background: var(--surface); position: relative; }
.ms:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.ms .chip { display: inline-flex; align-items: center; gap: 4px; background: var(--primary-soft); color: #9a3a07; border-radius: 6px; padding: 2px 4px 2px 8px; font-size: 13px; }
.ms .chip button { border: 0; background: none; cursor: pointer; color: inherit; font-size: 15px; line-height: 1; padding: 0 3px; }
.ms input { border: 0; outline: none; flex: 1; min-width: 120px; font: inherit; padding: 3px 4px; background: transparent; }
.dropdown { position: absolute; top: calc(100% + 4px); left: 0; right: 0; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow-lg); max-height: 260px; overflow: auto; z-index: 20; padding: 4px; }
.dropdown div { padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.dropdown div:hover, .dropdown div.sel { background: var(--surface-2); }
.dropdown .none { color: var(--muted); cursor: default; }

/* searchable select */
.ss { position: relative; }
.ss .ss-btn { text-align: left; display: flex; align-items: center; justify-content: space-between; cursor: pointer; gap: 8px; }
.ss .ss-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ss .ss-btn .ph { color: var(--muted); }
.ss .ss-pop { position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 25; background: var(--surface); border: 1px solid var(--border); border-radius: 9px; box-shadow: var(--shadow-lg); padding: 6px; }
.ss .ss-pop input { width: 100%; margin-bottom: 4px; }
.ss .ss-list { max-height: 260px; overflow: auto; }
.ss .ss-list div { padding: 7px 10px; border-radius: 6px; cursor: pointer; }
.ss .ss-list div:hover, .ss .ss-list div.sel { background: var(--surface-2); }

/* lines editor */
.lines { border: 1px solid var(--border); border-radius: var(--radius-sm); overflow-x: auto; }
.lines table { width: 100%; border-collapse: collapse; }
.lines th { font-size: 12px; color: var(--muted); text-align: left; padding: 7px 8px; background: var(--surface-2); border-bottom: 1px solid var(--border); font-weight: 600; }
.lines td { padding: 4px; border-bottom: 1px solid var(--border); }
.lines td .input { min-height: 34px; padding: 6px 8px; }
.lines .add { padding: 8px; }

/* file field */
.files { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.file-chip { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); border-radius: 7px; padding: 4px 6px 4px 10px; background: var(--surface-2); font-size: 13px; }
.file-chip a:hover { text-decoration: underline; }
.file-chip button { border: 0; background: none; cursor: pointer; color: var(--muted); font-size: 16px; }

/* ---------- list toolbar ---------- */
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 14px 18px; border-bottom: 1px solid var(--border); }
.toolbar .input { width: auto; min-height: 36px; padding: 6px 10px; font-size: 13.5px; }
.toolbar .search { flex: 1; min-width: 180px; max-width: 320px; }
.toolbar .grow { flex: 1; }
.pager { display: flex; align-items: center; gap: 8px; padding: 12px 18px; justify-content: space-between; color: var(--muted); font-size: 13px; flex-wrap: wrap; }
.desc { color: var(--muted); font-size: 13.5px; margin: -10px 0 16px; }

/* ---------- detail ---------- */
.dl { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0; }
.dl > div { grid-column: span 2; padding: 10px 0; border-bottom: 1px solid var(--border); padding-right: 14px; min-width: 0; }
.dl > div.w-full { grid-column: span 6; }
.dl dt { font-size: 12px; color: var(--muted); margin-bottom: 2px; }
.dl dd { margin: 0; font-weight: 500; word-wrap: break-word; white-space: pre-wrap; }
.timeline { list-style: none; padding: 0; margin: 0; font-size: 13px; }
.timeline li { padding: 6px 0; border-bottom: 1px dashed var(--border); color: var(--muted); }
.timeline li b { color: var(--text); font-weight: 600; }

/* ---------- calendar ---------- */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-left: 1px solid var(--border); border-top: 1px solid var(--border); }
.cal .dh { background: var(--surface-2); font-size: 12px; font-weight: 600; color: var(--muted); padding: 8px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); text-align: center; }
.cal .day { min-height: 116px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; background: var(--surface); position: relative; }
.cal .day.out { background: #fafbfc; }
.cal .day.out .dn { color: #b8bec8; }
.cal .day.today .dn { background: var(--primary); color: #fff; }
.cal .dn { font-size: 12.5px; font-weight: 600; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; }
.cal .add { position: absolute; top: 6px; right: 6px; opacity: 0; color: var(--muted); padding: 2px; border-radius: 5px; }
.cal .day:hover .add { opacity: 1; }
.cal .add:hover { background: var(--surface-2); color: var(--primary); }
.ev { display: block; font-size: 12px; padding: 3px 6px; border-radius: 5px; margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid currentColor; }
.ev small { opacity: .8; }

/* color helpers for events / cells */
.c-gray { background: #eef0f3; color: #4b5260; }
.c-blue { background: #e8f0fe; color: #1d4fd7; }
.c-green { background: #e6f6ec; color: #13703a; }
.c-red { background: #fdeaea; color: #b42323; }
.c-orange { background: #fff0e5; color: #c2410c; }
.c-amber { background: #fdf5dd; color: #946200; }
.c-purple { background: #f1ebfe; color: #6b34c9; }
.c-teal { background: #e2f6f3; color: #0f766e; }
.c-cyan { background: #e0f5fa; color: #0e7490; }

/* ---------- month grids (devam / iş planı) ---------- */
.mgrid { border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
.mgrid th, .mgrid td { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.mgrid thead th { position: sticky; top: 0; background: var(--surface-2); z-index: 2; padding: 6px 2px; text-align: center; font-weight: 600; color: var(--muted); min-width: 38px; }
.mgrid thead th.we { color: var(--danger); }
.mgrid .name { position: sticky; left: 0; background: var(--surface); z-index: 1; padding: 6px 12px; text-align: left; white-space: nowrap; min-width: 170px; font-weight: 550; }
.mgrid thead .name { z-index: 3; background: var(--surface-2); }
.mgrid td.cell { text-align: center; cursor: pointer; height: 36px; min-width: 38px; padding: 2px; }
.mgrid td.cell:hover { outline: 2px solid var(--primary); outline-offset: -2px; }
.mgrid td.we { background: #fbfbfc; }
.mgrid td.today, .mgrid th.today { box-shadow: inset 0 0 0 2px rgba(232,89,12,.45); }
.mgrid .tag { display: inline-block; min-width: 26px; padding: 3px 4px; border-radius: 5px; font-weight: 650; }
.mgrid.plan td.cell { vertical-align: top; text-align: left; min-width: 116px; max-width: 150px; height: 64px; padding: 3px; }
.mgrid.plan .job { display: block; font-size: 11.5px; padding: 2px 5px; border-radius: 4px; margin-bottom: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid currentColor; }
.mgrid.plan td.izin { background: repeating-linear-gradient(45deg, #f5f7fa, #f5f7fa 6px, #eceff3 6px, #eceff3 12px); }
.popover { position: fixed; z-index: 60; background: var(--surface); border: 1px solid var(--border); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 6px; min-width: 170px; }
.popover button { display: flex; width: 100%; align-items: center; gap: 8px; border: 0; background: none; padding: 7px 10px; border-radius: 6px; cursor: pointer; font: inherit; text-align: left; }
.popover button:hover { background: var(--surface-2); }
.legend { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- toast ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { background: #15171c; color: #fff; padding: 11px 16px; border-radius: 10px; box-shadow: var(--shadow-lg); font-size: 14px; display: flex; gap: 9px; align-items: center; animation: slidein .2s ease; max-width: 420px; }
.toast.err { background: #a11d1d; }
.toast-link { color: #ffb38a; text-decoration: underline; margin-left: 6px; white-space: nowrap; }

/* ---------- açılır pencere (yeni kayıt formları) ---------- */
body.modal-open { overflow: hidden; }
.modal-wrap { position: fixed; inset: 0; z-index: 80; background: rgba(10, 12, 16, .5); display: flex; align-items: flex-start; justify-content: center; padding: 4vh 16px; animation: fadein .15s ease; }
.modal { background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: min(960px, 100%); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px 20px; border-bottom: 1px solid var(--border); }
.modal-head h2 { margin: 0 auto 0 0; font-size: 17px; }
.modal-body { padding: 18px 20px 0; overflow: auto; flex: 1; }
.modal-body .form-actions { position: sticky; bottom: 0; background: var(--surface); margin: 20px -20px 0; padding: 12px 20px; }
.modal-loading { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 14px 16px 14px 20px; color: var(--muted); }
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } to { transform: none; opacity: 1; } }

/* ---------- login ---------- */
.login-page { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; background: var(--surface); }
.login-art { background: radial-gradient(1200px 600px at -10% -10%, #2a2f39 0%, #14161b 55%); color: #d7dbe2; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; position: relative; overflow: hidden; }
.login-art::after { content: ""; position: absolute; width: 520px; height: 520px; right: -160px; bottom: -160px; border-radius: 50%; background: radial-gradient(circle, rgba(232,89,12,.35), transparent 65%); }
.login-art img { height: 56px; width: auto; align-self: flex-start; }
.login-art h2 { font-size: 30px; color: #fff; font-weight: 650; max-width: 440px; letter-spacing: -.02em; line-height: 1.2; }
.login-art ul { list-style: none; padding: 0; margin: 22px 0 0; display: grid; gap: 10px; }
.login-art li { display: flex; gap: 10px; align-items: center; color: #b9bfc9; }
.login-art li svg { color: var(--primary); }
.login-box { display: flex; align-items: center; justify-content: center; padding: 32px 20px; }
.login-box form { width: 100%; max-width: 370px; }
.login-box h1 { font-size: 24px; margin-bottom: 6px; }
.login-box .fld { margin-bottom: 14px; }
.login-box .input { min-height: 44px; font-size: 15px; }
.login-box .btn { width: 100%; min-height: 44px; font-size: 15px; }
.alert { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 14px; }
.alert-err { background: #fdeaea; color: #8f1d1d; border: 1px solid #f3c2c2; }
.alert-ok { background: #e6f6ec; color: #13703a; border: 1px solid #bfe5cc; }
.alert-info { background: #eaf1fe; color: #1d3f8f; border: 1px solid #c7d8fb; }
.pw-wrap { position: relative; }
.pw-wrap button { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); }

/* ---------- chat ---------- */
.chat-layout { display: grid; grid-template-columns: 270px minmax(0, 1fr); gap: 0; height: calc(100vh - 58px); margin: -24px; }
.chat-side { border-right: 1px solid var(--border); background: var(--surface); display: flex; flex-direction: column; min-height: 0; }
.chat-side .top { padding: 14px; border-bottom: 1px solid var(--border); display: grid; gap: 8px; }
.chat-side .list { overflow-y: auto; padding: 8px; flex: 1; }
.chat-side .conv { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 8px; font-size: 13.5px; }
.chat-side .conv:hover { background: var(--surface-2); }
.chat-side .conv.active { background: var(--primary-soft); color: #9a3a07; }
.chat-side .conv span { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-side .conv button { opacity: 0; border: 0; background: none; cursor: pointer; color: var(--muted); padding: 2px; }
.chat-side .conv:hover button { opacity: 1; }
.chat-main { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.chat-scroll { flex: 1; overflow-y: auto; padding: 24px 24px 12px; }
.chat-inner { max-width: 860px; margin: 0 auto; }
.msg { margin-bottom: 18px; display: flex; gap: 12px; }
.msg .av { width: 32px; height: 32px; border-radius: 50%; flex: none; display: grid; place-items: center; font-weight: 650; font-size: 13px; }
.msg.user { flex-direction: row-reverse; }
.msg.user .av { background: #2a2f39; color: #fff; }
.msg.ai .av { background: var(--primary); color: #fff; }
.msg .bubble { max-width: calc(100% - 50px); min-width: 0; }
.msg.user .bubble { background: #2a2f39; color: #fff; padding: 10px 14px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.ai .bubble { background: var(--surface); border: 1px solid var(--border); padding: 12px 16px; border-radius: 14px 14px 14px 4px; box-shadow: var(--shadow); }
.msg .files { margin-top: 6px; }
.prose { word-wrap: break-word; }
.prose p { margin: 0 0 9px; }
.prose p:last-child { margin-bottom: 0; }
.prose ul, .prose ol { margin: 4px 0 10px; padding-left: 22px; }
.prose li { margin: 2px 0; }
.prose code { font-family: var(--mono); font-size: 12.5px; background: #f1f3f5; padding: 1px 5px; border-radius: 4px; }
.prose pre { background: #15171c; color: #e6e8eb; padding: 12px; border-radius: 8px; overflow-x: auto; font-size: 12.5px; }
.prose pre code { background: none; padding: 0; color: inherit; }
.prose table { border-collapse: collapse; margin: 8px 0; font-size: 13px; display: block; overflow-x: auto; }
.prose th, .prose td { border: 1px solid var(--border); padding: 5px 9px; text-align: left; }
.prose th { background: var(--surface-2); }
.prose h1, .prose h2, .prose h3 { margin: 12px 0 6px; font-size: 15px; }
.steps { margin: 6px 0 10px; display: grid; gap: 4px; }
.step { display: flex; gap: 8px; align-items: flex-start; font-size: 12.8px; color: var(--muted); padding: 5px 9px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 7px; }
.step svg { margin-top: 1px; }
.step .d { font-family: var(--mono); font-size: 12px; color: #4b5260; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.step.err { color: var(--danger); border-color: #f3c2c2; background: #fdf3f3; }
.done-bar { font-size: 12.5px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--border); }
.typing { display: inline-flex; gap: 4px; padding: 6px 0; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--primary); animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; }
.typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.composer { border-top: 1px solid var(--border); background: var(--surface); padding: 12px 24px 16px; }
.composer .box { max-width: 860px; margin: 0 auto; border: 1px solid var(--border-strong); border-radius: 14px; padding: 8px; background: var(--surface); }
.composer .box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.composer textarea { width: 100%; border: 0; outline: none; resize: none; font: inherit; font-size: 15px; padding: 6px 8px; min-height: 48px; max-height: 260px; background: transparent; }
.composer .bar { display: flex; align-items: center; gap: 8px; }
.composer .att { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 6px 6px; }
.composer .hint { max-width: 860px; margin: 6px auto 0; font-size: 12px; color: var(--muted); text-align: center; }
.dropzone-over .composer .box { border-color: var(--primary); background: var(--primary-soft); }
.suggest { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.suggest button { text-align: left; border: 1px solid var(--border); background: var(--surface); border-radius: 10px; padding: 12px 14px; cursor: pointer; font: inherit; color: var(--text); display: flex; gap: 10px; align-items: flex-start; }
.suggest button:hover { border-color: var(--primary); background: var(--primary-soft); }
.suggest button svg { color: var(--primary); margin-top: 2px; }
.chat-hero { text-align: center; padding: 40px 0 10px; }
.chat-hero .logo-ai { width: 56px; height: 56px; border-radius: 16px; background: var(--primary); color: #fff; display: inline-grid; place-items: center; margin-bottom: 12px; }
.chat-hero .logo-ai svg { width: 30px; height: 30px; }

/* ---------- diff ---------- */
.diff { font-family: var(--mono); font-size: 12.3px; background: #fbfbfc; border: 1px solid var(--border); border-radius: 8px; overflow-x: auto; padding: 10px 0; white-space: pre; line-height: 1.45; }
.diff span { display: block; padding: 0 14px; }
.diff .a { background: #e6f6ec; color: #11602f; }
.diff .d { background: #fdeaea; color: #8f1d1d; }
.diff .h { color: #6b34c9; background: #f6f2fe; }
.diff .f { font-weight: 700; color: #15171c; background: #eef0f3; margin-top: 8px; }

/* ---------- tour ---------- */
.tour-backdrop { position: fixed; inset: 0; z-index: 200; pointer-events: none; }
.tour-hole { position: fixed; z-index: 201; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(10, 12, 16, .62); transition: all .25s ease; pointer-events: none; }
.tour-pop { position: fixed; z-index: 202; background: var(--surface); border-radius: 14px; box-shadow: var(--shadow-lg); width: 340px; max-width: calc(100vw - 24px); padding: 18px; transition: top .25s ease, left .25s ease; }
.tour-pop h3 { font-size: 16px; margin-bottom: 6px; display: flex; gap: 8px; align-items: center; }
.tour-pop h3 svg { color: var(--primary); }
.tour-pop p { margin: 0 0 14px; color: #3f4651; font-size: 14px; }
.tour-pop .tbar { display: flex; align-items: center; gap: 8px; }
.tour-pop .dots { display: flex; gap: 4px; margin-right: auto; }
.tour-pop .dots i { width: 6px; height: 6px; border-radius: 50%; background: #d5d9df; }
.tour-pop .dots i.on { background: var(--primary); width: 16px; border-radius: 3px; }
.tour-pop.center { top: 50% !important; left: 50% !important; transform: translate(-50%, -50%); width: 420px; text-align: center; padding: 28px 24px 20px; }
.tour-pop.center img { height: 46px; margin-bottom: 14px; }
.tour-pop.center h3 { justify-content: center; font-size: 19px; }

/* ---------- print ---------- */
.print-page { background: #fff; max-width: 820px; margin: 24px auto; padding: 40px 44px; box-shadow: var(--shadow-lg); border-radius: 6px; color: #111; }
.print-tools { max-width: 820px; margin: 18px auto 0; display: flex; gap: 8px; justify-content: flex-end; }
.print-head { display: flex; justify-content: space-between; align-items: flex-start; border-bottom: 2px solid #111; padding-bottom: 14px; margin-bottom: 20px; gap: 20px; }
.print-head img { height: 54px; }
.print-head .co { text-align: right; font-size: 12px; line-height: 1.5; color: #333; }
.print-title { text-align: center; font-size: 20px; font-weight: 700; letter-spacing: .08em; margin: 6px 0 18px; }
.print-page table.pt { width: 100%; border-collapse: collapse; font-size: 13px; margin: 10px 0; }
.print-page table.pt th, .print-page table.pt td { border: 1px solid #999; padding: 6px 8px; }
.print-page table.pt th { background: #f0f0f0; text-align: left; }
.sign { display: grid; grid-template-columns: 1fr 1fr; gap: 40px; margin-top: 50px; text-align: center; font-size: 13px; }
.sign div { border-top: 1px solid #555; padding-top: 6px; }
@media print {
  body { background: #fff; }
  .sidebar, .topbar, .no-print, .print-tools, .toasts { display: none !important; }
  .main { margin: 0 !important; }
  .content { padding: 0 !important; max-width: none; }
  .card { box-shadow: none; border: 0; padding: 0; }
  .print-page { box-shadow: none; margin: 0; padding: 0; max-width: none; }
  a { text-decoration: none !important; color: inherit !important; }
}

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { transform: translateX(-100%); box-shadow: var(--shadow-lg); }
  body.nav-open .sidebar { transform: none; }
  body.nav-open::after { content: ""; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 35; }
  .main { margin-left: 0; }
  .topbar { padding: 0 12px; }
  .topbar .menu-btn { display: inline-flex; }
  .content { padding: 16px; }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .fld, .fld.w-third, .fld.w-full { grid-column: auto; }
  .dl { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .dl > div, .dl > div.w-full { grid-column: span 2; }
  .login-page { grid-template-columns: minmax(0, 1fr); }
  .login-art { display: none; }
  .chat-layout { grid-template-columns: minmax(0, 1fr); margin: -16px; height: calc(100vh - 58px); }
  .chat-side { display: none; }
  .chat-side.open { display: flex; position: fixed; inset: 58px 0 0 0; z-index: 25; }
  .chat-scroll { padding: 16px 12px 8px; }
  .composer { padding: 10px 12px 12px; }
  .suggest { grid-template-columns: minmax(0, 1fr); }
  .cal .day { min-height: 74px; padding: 3px; }
  .ev { font-size: 10.5px; padding: 1px 3px; }
  .ev small { display: none; }
  .print-page { padding: 20px 16px; margin: 0; }
  .hide-sm { display: none !important; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .stat { padding: 12px; flex-direction: column; gap: 8px; }
  .stat .ico { width: 32px; height: 32px; }
  .stat .val { font-size: 16px; }
  .page-head h1 { font-size: 19px; }
  .modal-wrap { padding: 0; }
  .modal { width: 100%; max-height: none; height: 100%; border-radius: 0; }
}
@media (min-width: 901px) { .show-sm { display: none !important; } }
.login-box .pw-wrap .input { padding-right: 46px; }
.login-box .pw-wrap button { width: auto; min-height: 0; padding: 6px; right: 6px; }
