:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --surface-2: #f7f9fc;
  --surface-dark: #0b1220;
  --surface-dark-2: #121b2d;
  --text: #172033;
  --muted: #6f7b90;
  --line: #e4e9f1;
  --primary: #3568ff;
  --primary-dark: #2455e5;
  --primary-soft: #eef3ff;
  --success: #16a66a;
  --success-soft: #e9f8f1;
  --warning: #e79a18;
  --warning-soft: #fff5df;
  --danger: #df4d58;
  --danger-soft: #fff0f1;
  --purple: #7657e8;
  --purple-soft: #f2efff;
  --shadow-sm: 0 8px 24px rgba(16, 30, 54, .06);
  --shadow-md: 0 18px 60px rgba(16, 30, 54, .13);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 22px;
  --sidebar: 264px;
  --topbar: 76px;
  --surface-hover: #f9fbfe;
  --topbar-bg: rgba(243,246,251,.88);
  --topbar-border: rgba(218,224,234,.8);
}

body[data-theme="dark"] {
  --bg: #0f1726;
  --surface: #121c30;
  --surface-2: #172339;
  --text: #edf2ff;
  --muted: #98a6be;
  --line: #25344f;
  --primary-soft: rgba(53,104,255,.18);
  --success-soft: rgba(22,166,106,.16);
  --warning-soft: rgba(231,154,24,.16);
  --danger-soft: rgba(223,77,88,.16);
  --purple-soft: rgba(118,87,232,.18);
  --shadow-sm: 0 10px 28px rgba(0,0,0,.26);
  --shadow-md: 0 22px 64px rgba(0,0,0,.34);
  --surface-hover: #1a2740;
  --topbar-bg: rgba(15,23,38,.88);
  --topbar-border: rgba(37,52,79,.95);
}

body.compact-mode {
  --topbar: 70px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar);
  background:
    radial-gradient(circle at 20% 0%, rgba(79, 113, 255, .24), transparent 32%),
    linear-gradient(180deg, #0c1424 0%, #0a111e 100%);
  color: #fff;
  z-index: 80;
  display: flex;
  flex-direction: column;
  border-right: 1px solid rgba(255,255,255,.05);
}
.brand {
  min-height: var(--topbar);
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 22px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #5e83ff, #2756e9);
  box-shadow: 0 8px 24px rgba(53,104,255,.32);
  font-weight: 800;
  font-size: 16px;
  letter-spacing: -.6px;
}
.brand-copy strong { display: block; font-size: 15px; letter-spacing: -.2px; }
.brand-copy span { display: block; color: #8f9bb1; font-size: 11px; margin-top: 3px; }
.sidebar-nav { padding: 18px 12px; display: grid; gap: 5px; overflow-y: auto; scrollbar-width: thin; }
.nav-label { color: #69758b; font-size: 10px; text-transform: uppercase; letter-spacing: 1.1px; padding: 10px 12px 6px; font-weight: 700; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #aeb8ca;
  min-height: 44px;
  padding: 0 13px;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 600;
  transition: .18s ease;
}
.nav-item:hover { color: #fff; background: rgba(255,255,255,.06); }
.nav-item.active { color: #fff; background: rgba(82,117,255,.18); box-shadow: inset 0 0 0 1px rgba(104,136,255,.2); }
.nav-item i, .nav-item svg { width: 18px; height: 18px; }
.nav-badge { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; display: grid; place-items: center; border-radius: 999px; background: rgba(255,255,255,.09); font-size: 10px; }
.sidebar-foot { margin-top: auto; padding: 14px 12px 18px; }
.storage-card { border: 1px solid rgba(255,255,255,.08); background: rgba(255,255,255,.045); border-radius: 14px; padding: 14px; }
.storage-card .eyebrow { color: #8290a7; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .8px; }
.storage-card strong { display: block; font-size: 12px; margin-top: 7px; }
.storage-card p { margin: 5px 0 0; color: #8e99ac; font-size: 10px; line-height: 1.5; }

.main-wrap { margin-left: var(--sidebar); min-height: 100vh; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--topbar);
  background: var(--topbar-bg);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--topbar-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 30px;
}
.topbar-left { display: flex; align-items: center; gap: 12px; }
.mobile-menu { display: none; }
.page-heading h1 { margin: 0; font-size: 21px; letter-spacing: -.55px; }
.page-heading p { margin: 5px 0 0; color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 40px; height: 40px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; display: grid; place-items: center; color: #506078; box-shadow: 0 4px 16px rgba(21,34,54,.04); position: relative;
}
.icon-btn svg { width: 18px; height: 18px; }
.notification-dot { position: absolute; width: 7px; height: 7px; background: var(--danger); border-radius: 50%; top: 8px; right: 8px; box-shadow: 0 0 0 2px var(--surface); }
.profile-chip { display: flex; align-items: center; gap: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; height: 44px; padding: 0 12px 0 7px; }
.avatar { width: 31px; height: 31px; border-radius: 10px; display: grid; place-items: center; font-size: 11px; font-weight: 800; color: #fff; background: linear-gradient(135deg, #1b2941, #405a80); }
.profile-chip strong { font-size: 11px; display: block; }
.profile-chip span { font-size: 9px; color: var(--muted); display: block; margin-top: 2px; }

.page-content { padding: 26px 30px 42px; max-width: 1620px; margin: 0 auto; }
.page-tools { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 18px; }
.tool-group { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
.search-box { position: relative; min-width: 250px; }
.search-box svg { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); width: 17px; color: #8792a5; }
.search-box input { width: 100%; height: 42px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); padding: 0 14px 0 40px; outline: none; color: var(--text); }
.search-box input:focus, .form-control:focus { border-color: #9db3ff; box-shadow: 0 0 0 4px rgba(53,104,255,.08); }
.btn { min-height: 42px; border: 0; border-radius: 11px; padding: 0 16px; display: inline-flex; align-items: center; justify-content: center; gap: 8px; font-weight: 700; font-size: 12px; transition: .18s ease; white-space: nowrap; }
.btn svg { width: 16px; height: 16px; }
.btn-primary { background: var(--primary); color: #fff; box-shadow: 0 8px 20px rgba(53,104,255,.2); }
.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-secondary { background: var(--surface); color: #48566d; border: 1px solid var(--line); }
.btn-secondary:hover { background: var(--surface-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger-soft { background: var(--danger-soft); color: var(--danger); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-sm { min-height: 34px; padding: 0 11px; font-size: 10px; border-radius: 9px; }
.btn-block { width: 100%; }

.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap: 16px; margin-bottom: 18px; }
.stat-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); min-width: 0; position: relative; overflow: hidden; }
.stat-card::after { content:""; position: absolute; width: 90px; height: 90px; border-radius: 50%; right: -35px; top: -38px; background: var(--tint, var(--primary-soft)); opacity: .8; }
.stat-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.stat-label { color: var(--muted); font-size: 11px; font-weight: 600; }
.stat-value { margin-top: 10px; font-size: 24px; font-weight: 800; letter-spacing: -.8px; overflow-wrap: anywhere; }
.stat-sub { margin-top: 8px; color: var(--muted); font-size: 10px; display: flex; align-items: center; gap: 6px; }
.stat-icon { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--tint, var(--primary-soft)); color: var(--tone, var(--primary)); position: relative; z-index: 1; }
.stat-icon svg { width: 18px; height: 18px; }
.trend-up { color: var(--success); font-weight: 700; }
.trend-down { color: var(--danger); font-weight: 700; }

.dashboard-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(320px, .8fr); gap: 18px; }
.stack { display: grid; gap: 18px; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); overflow: hidden; }
.panel-head { min-height: 58px; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line); }
.panel-title { display: flex; align-items: center; gap: 10px; }
.panel-title h2 { margin: 0; font-size: 13px; letter-spacing: -.2px; }
.panel-title span { color: var(--muted); font-size: 10px; }
.panel-body { padding: 18px; }
.chart-wrap { height: 275px; }

.list { display: grid; }
.list-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.list-row:last-child { border-bottom: 0; }
.list-main { min-width: 0; display: flex; align-items: center; gap: 12px; }
.list-icon { flex: 0 0 38px; width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: #5e6c82; }
.list-icon svg { width: 17px; }
.list-copy { min-width: 0; }
.list-copy strong { display: block; font-size: 11px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-copy span { display: block; color: var(--muted); font-size: 9px; margin-top: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-side { text-align: right; }
.list-side strong { font-size: 11px; display: block; }
.list-side span { font-size: 9px; color: var(--muted); display: block; margin-top: 5px; }

.badge { display: inline-flex; align-items: center; gap: 5px; min-height: 24px; padding: 0 9px; border-radius: 999px; font-size: 9px; font-weight: 700; white-space: nowrap; }
.badge-dot::before { content:""; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.badge-blue { color: #2f60e8; background: #eef3ff; }
.badge-green { color: #17855a; background: #eaf8f2; }
.badge-amber { color: #b8750b; background: #fff4dd; }
.badge-red { color: #c43f4b; background: #fff0f1; }
.badge-gray { color: #6e798c; background: #f0f3f7; }
.badge-purple { color: #6a4ed5; background: #f0edff; }

.progress { height: 7px; border-radius: 999px; background: #edf1f6; overflow: hidden; }
.progress > span { height: 100%; display: block; border-radius: inherit; background: linear-gradient(90deg, #3568ff, #6f8fff); }
.progress-meta { display: flex; align-items: center; justify-content: space-between; font-size: 9px; color: var(--muted); margin-bottom: 7px; }

.table-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.table-scroll { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 840px; }
th { text-align: left; height: 46px; padding: 0 16px; background: #f8fafd; color: #758197; font-size: 9px; text-transform: uppercase; letter-spacing: .6px; font-weight: 800; border-bottom: 1px solid var(--line); }
td { height: 65px; padding: 0 16px; border-bottom: 1px solid var(--line); font-size: 11px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fbfcfe; }
.person { display: flex; align-items: center; gap: 10px; min-width: 180px; }
.person-avatar { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-size: 10px; font-weight: 800; flex: 0 0 auto; }
.person strong { font-size: 11px; display: block; }
.person span { font-size: 9px; color: var(--muted); display: block; margin-top: 4px; }
.actions { display: flex; align-items: center; gap: 6px; }
.action-btn { width: 32px; height: 32px; border: 1px solid var(--line); background: #fff; color: #657188; border-radius: 9px; display: grid; place-items: center; }
.action-btn:hover { border-color: #b6c5ef; color: var(--primary); }
.action-btn svg { width: 14px; height: 14px; }

.cards-grid { display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); gap: 16px; }
.entity-card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); padding: 18px; min-width: 0; }
.entity-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.entity-title { min-width: 0; }
.entity-title strong { display: block; font-size: 13px; letter-spacing: -.2px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.entity-title span { display: block; color: var(--muted); font-size: 9px; margin-top: 5px; }
.entity-card p { font-size: 10px; color: #68758a; line-height: 1.6; margin: 14px 0; min-height: 32px; }
.entity-meta { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.entity-meta-item { font-size: 9px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.entity-meta-item svg { width: 13px; height: 13px; }
.entity-foot { border-top: 1px solid var(--line); margin-top: 16px; padding-top: 14px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.money { font-weight: 800; letter-spacing: -.25px; }

.kanban { display: grid; grid-template-columns: repeat(4, minmax(250px,1fr)); gap: 14px; overflow-x: auto; padding-bottom: 8px; }
.kanban-col { background: #edf1f6; border-radius: var(--radius); padding: 12px; min-height: 430px; }
.kanban-head { display: flex; align-items: center; justify-content: space-between; padding: 4px 4px 12px; }
.kanban-head strong { font-size: 11px; }
.kanban-count { width: 23px; height: 23px; border-radius: 8px; display: grid; place-items: center; background: #fff; color: var(--muted); font-size: 9px; font-weight: 700; }
.kanban-cards { display: grid; gap: 10px; }
.task-card { background: #fff; border: 1px solid #dfe5ee; border-radius: 13px; padding: 13px; box-shadow: 0 6px 14px rgba(17,30,49,.04); }
.task-card h3 { font-size: 11px; line-height: 1.45; margin: 9px 0 12px; }
.task-card p { margin: 0 0 12px; font-size: 9px; line-height: 1.55; color: var(--muted); }
.task-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task-date { font-size: 8px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.task-date svg { width: 12px; }

.filter-tabs { display: inline-flex; gap: 4px; border: 1px solid var(--line); background: var(--surface); border-radius: 12px; padding: 4px; }
.filter-tab { border: 0; background: transparent; height: 32px; padding: 0 11px; border-radius: 9px; color: var(--muted); font-size: 10px; font-weight: 700; }
.filter-tab.active { background: var(--surface-dark); color: #fff; }

.empty-state { padding: 56px 20px; text-align: center; }
.empty-icon { width: 58px; height: 58px; border-radius: 18px; background: var(--primary-soft); color: var(--primary); display: grid; place-items: center; margin: 0 auto 14px; }
.empty-icon svg { width: 24px; height: 24px; }
.empty-state h3 { margin: 0; font-size: 14px; }
.empty-state p { margin: 8px auto 18px; max-width: 390px; color: var(--muted); font-size: 10px; line-height: 1.6; }

.import-grid { display: grid; grid-template-columns: minmax(0,1.15fr) minmax(320px,.85fr); gap: 18px; }
.import-box { min-height: 340px; width: 100%; border: 1px solid var(--line); background: #fbfcfe; border-radius: 14px; padding: 16px; resize: vertical; outline: none; line-height: 1.65; font-size: 11px; color: var(--text); }
.import-box:focus { border-color: #9db3ff; box-shadow: 0 0 0 4px rgba(53,104,255,.08); }
.preview-card { border: 1px dashed #cfd8e7; background: #fafcff; border-radius: 14px; padding: 16px; }
.preview-list { display: grid; gap: 10px; margin-top: 14px; }
.preview-item { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; border-bottom: 1px solid var(--line); padding-bottom: 10px; }
.preview-item:last-child { border: 0; padding-bottom: 0; }
.preview-item span { color: var(--muted); font-size: 9px; }
.preview-item strong { font-size: 10px; text-align: right; max-width: 62%; word-break: break-word; }
.guide { margin-top: 18px; padding: 15px; border-radius: 14px; background: #f5f8ff; border: 1px solid #e0e8ff; }
.guide strong { font-size: 10px; display: block; }
.guide p { margin: 7px 0 0; color: #65748c; font-size: 9px; line-height: 1.65; }
.code-sample { margin-top: 10px; border-radius: 11px; background: #101827; color: #bdc8db; padding: 13px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 9px; line-height: 1.7; white-space: pre-wrap; }

.ai-layout { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 18px; height: calc(100vh - 144px); min-height: 590px; }
.ai-chat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
.ai-head { height: 66px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 18px; }
.ai-agent { display: flex; align-items: center; gap: 11px; }
.ai-agent-icon { width: 38px; height: 38px; border-radius: 13px; background: linear-gradient(135deg,#17213a,#3568ff); color: #fff; display: grid; place-items: center; }
.ai-agent strong { display: block; font-size: 11px; }
.ai-agent span { display: flex; align-items: center; gap: 5px; color: var(--success); font-size: 8px; margin-top: 4px; }
.ai-agent span::before { content:""; width: 5px; height: 5px; border-radius: 50%; background: var(--success); }
.ai-messages { flex: 1; overflow-y: auto; padding: 22px; display: flex; flex-direction: column; gap: 16px; }
.message { max-width: 78%; display: flex; gap: 9px; }
.message.assistant { align-self: flex-start; }
.message.user { align-self: flex-end; flex-direction: row-reverse; }
.message-avatar { width: 28px; height: 28px; flex: 0 0 28px; border-radius: 9px; display: grid; place-items: center; background: #142039; color: #fff; font-size: 9px; font-weight: 800; }
.message.user .message-avatar { background: var(--primary); }
.message-bubble { padding: 12px 14px; border-radius: 14px; background: #f1f4f8; color: #344056; font-size: 10px; line-height: 1.65; white-space: pre-wrap; }
.message.user .message-bubble { background: var(--primary); color: #fff; border-bottom-right-radius: 5px; }
.message.assistant .message-bubble { border-bottom-left-radius: 5px; }
.ai-compose { padding: 14px; border-top: 1px solid var(--line); }
.ai-input-wrap { display: flex; align-items: flex-end; gap: 10px; background: #f7f9fc; border: 1px solid var(--line); border-radius: 14px; padding: 8px; }
.ai-input-wrap textarea { flex: 1; min-height: 40px; max-height: 120px; resize: none; border: 0; background: transparent; outline: none; padding: 9px 8px; font-size: 10px; line-height: 1.5; }
.send-btn { width: 40px; height: 40px; border: 0; border-radius: 11px; background: var(--primary); color: #fff; display: grid; place-items: center; flex: 0 0 auto; }
.ai-side { display: flex; flex-direction: column; gap: 14px; overflow-y: auto; }
.prompt-list { display: grid; gap: 8px; }
.prompt-chip { border: 1px solid var(--line); border-radius: 11px; background: #fff; padding: 11px; text-align: left; color: #4b5870; font-size: 9px; line-height: 1.45; }
.prompt-chip:hover { border-color: #a9bbef; color: var(--primary); }
.context-stat { display: grid; grid-template-columns: 1fr auto; gap: 8px; font-size: 9px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.context-stat:last-child { border: 0; }
.context-stat span { color: var(--muted); }
.context-stat strong { font-size: 10px; }

.settings-grid { display: grid; grid-template-columns: 230px minmax(0,1fr); gap: 18px; }
.settings-menu { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; height: fit-content; position: sticky; top: 100px; }
.settings-tab { width: 100%; border: 0; background: transparent; display: flex; align-items: center; gap: 10px; min-height: 42px; border-radius: 10px; padding: 0 11px; font-size: 10px; font-weight: 700; color: var(--muted); text-align: left; }
.settings-tab.active { background: var(--primary-soft); color: var(--primary); }
.settings-tab svg { width: 16px; }
.settings-section { display: none; }
.settings-section.active { display: block; }
.form-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); gap: 14px; }
.form-group { display: grid; gap: 7px; }
.form-group.full { grid-column: 1 / -1; }
.form-label { color: #536079; font-size: 9px; font-weight: 700; }
.form-control { width: 100%; min-height: 42px; border: 1px solid var(--line); background: #fff; border-radius: 11px; padding: 0 12px; outline: none; font-size: 10px; color: var(--text); }
textarea.form-control { min-height: 92px; resize: vertical; padding-top: 11px; line-height: 1.55; }
.form-help { color: var(--muted); font-size: 8px; line-height: 1.5; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.setting-row:last-child { border: 0; }
.setting-copy strong { display: block; font-size: 10px; }
.setting-copy span { display: block; color: var(--muted); font-size: 8px; margin-top: 5px; line-height: 1.5; }
.switch { width: 42px; height: 24px; border-radius: 999px; background: #dce2eb; position: relative; border: 0; transition: .2s; flex: 0 0 auto; }
.switch::after { content:""; position: absolute; width: 18px; height: 18px; border-radius: 50%; background: #fff; left: 3px; top: 3px; box-shadow: 0 2px 6px rgba(0,0,0,.15); transition: .2s; }
.switch.on { background: var(--primary); }
.switch.on::after { transform: translateX(18px); }

.modal-backdrop { position: fixed; inset: 0; background: rgba(5,12,24,.52); backdrop-filter: blur(5px); z-index: 200; display: grid; place-items: center; padding: 20px; opacity: 0; pointer-events: none; transition: .18s ease; }
.modal-backdrop.show { opacity: 1; pointer-events: auto; }
.modal { width: min(620px,100%); max-height: min(760px, calc(100vh - 40px)); overflow-y: auto; background: #fff; border-radius: 20px; box-shadow: var(--shadow-md); transform: translateY(12px) scale(.985); transition: .18s ease; }
.modal-backdrop.show .modal { transform: none; }
.modal-head { min-height: 62px; display: flex; align-items: center; justify-content: space-between; padding: 0 19px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--surface); z-index: 2; }
.modal-head h2 { margin: 0; font-size: 14px; letter-spacing: -.3px; }
.modal-close { width: 34px; height: 34px; display: grid; place-items: center; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; color: var(--muted); }
.modal-body { padding: 19px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 9px; padding: 15px 19px; border-top: 1px solid var(--line); position: sticky; bottom: 0; background: var(--surface); }

.toast-container { position: fixed; right: 22px; bottom: 22px; z-index: 300; display: grid; gap: 9px; }
.toast { width: min(340px, calc(100vw - 30px)); background: #101827; color: #fff; border-radius: 13px; padding: 13px 14px; box-shadow: 0 14px 40px rgba(5,11,21,.25); display: flex; align-items: flex-start; gap: 10px; animation: toast-in .22s ease; }
.toast.success { background: #0f6e4a; }
.toast.error { background: #9c3039; }
.toast svg { width: 17px; flex: 0 0 auto; margin-top: 1px; }
.toast strong { display: block; font-size: 10px; }
.toast span { display: block; font-size: 8px; opacity: .78; margin-top: 3px; line-height: 1.4; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

.mobile-bottom { display: none; }
.mobile-overlay { display: none; }

@media (max-width: 1180px) {
  .stats-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .cards-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .dashboard-grid { grid-template-columns: 1fr; }
  .ai-layout { grid-template-columns: 1fr; height: auto; }
  .ai-chat { min-height: 650px; }
  .ai-side { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); overflow: visible; }
}

@media (max-width: 880px) {
  :root { --topbar: 68px; }
  .sidebar { transform: translateX(-100%); transition: .2s ease; box-shadow: 18px 0 50px rgba(5,12,23,.2); }
  body.sidebar-open .sidebar { transform: translateX(0); }
  .mobile-overlay { position: fixed; inset: 0; background: rgba(8,14,25,.4); z-index: 70; display: block; opacity: 0; pointer-events: none; transition: .2s; }
  body.sidebar-open .mobile-overlay { opacity: 1; pointer-events: auto; }
  .main-wrap { margin-left: 0; padding-bottom: 74px; }
  .mobile-menu { display: grid; }
  .topbar { padding: 0 16px; }
  .top-actions .profile-chip { display: none; }
  .page-content { padding: 18px 16px 28px; }
  .mobile-bottom { position: fixed; z-index: 90; left: 10px; right: 10px; bottom: max(10px, env(safe-area-inset-bottom)); height: 58px; background: rgba(11,18,32,.95); backdrop-filter: blur(16px); border: 1px solid rgba(255,255,255,.08); border-radius: 18px; display: grid; grid-template-columns: repeat(5,1fr); padding: 5px; box-shadow: 0 18px 45px rgba(10,17,30,.28); }
  .mobile-nav-item { color: #7f8ca2; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 7px; font-weight: 700; border-radius: 12px; }
  .mobile-nav-item.active { color: #fff; background: rgba(85,119,255,.18); }
  .mobile-nav-item svg { width: 17px; height: 17px; }
  .settings-grid { grid-template-columns: 1fr; }
  .settings-menu { position: static; display: flex; overflow-x: auto; }
  .settings-tab { width: auto; min-width: max-content; padding: 0 13px; }
  .import-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .page-heading p { display: none; }
  .page-heading h1 { font-size: 17px; }
  .top-actions .icon-btn:first-child { display: none; }
  .page-tools { align-items: stretch; flex-direction: column; }
  .tool-group { width: 100%; }
  .search-box { flex: 1; min-width: 0; }
  .page-tools > .btn, .tool-group .btn { flex: 1; }
  .stats-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: 18px; }
  .stat-label { font-size: 9px; }
  .stat-sub { font-size: 8px; }
  .stat-icon { width: 33px; height: 33px; }
  .cards-grid { grid-template-columns: 1fr; }
  .panel-head { padding: 0 14px; }
  .panel-body { padding: 14px; }
  .list-row { padding: 13px 14px; }
  .chart-wrap { height: 230px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full { grid-column: auto; }
  .modal-backdrop { padding: 0; align-items: end; }
  .modal { width: 100%; max-height: 92vh; border-radius: 22px 22px 0 0; }
  .ai-layout { min-height: 0; }
  .ai-chat { min-height: calc(100vh - 165px); }
  .ai-side { grid-template-columns: 1fr; }
  .message { max-width: 91%; }
  .ai-messages { padding: 15px; }
  .import-box { min-height: 280px; }
  .toast-container { right: 15px; bottom: 82px; }
}

/* Operio v2 additions */
.sidebar-nav { overflow-y: auto; min-height: 0; }
.calendar-summary { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 16px; margin-bottom: 18px; }
.calendar-summary .stat-card { margin: 0; }
.calendar-list { display: grid; gap: 12px; }
.calendar-day { display: grid; grid-template-columns: 82px minmax(0,1fr); gap: 14px; align-items: stretch; }
.calendar-date { background: var(--surface-dark); color: #fff; border-radius: var(--radius); display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 92px; box-shadow: var(--shadow-sm); }
.calendar-date strong { font-size: 24px; letter-spacing: -.8px; }
.calendar-date span { color: #a9b4c7; text-transform: capitalize; font-size: 9px; margin-top: 5px; }
.calendar-events { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow-sm); }
.calendar-event { min-height: 72px; display: grid; grid-template-columns: 40px minmax(0,1fr) auto; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--line); }
.calendar-event:last-child { border-bottom: 0; }
.calendar-event:hover { background: var(--surface-hover); }
.calendar-event.overdue { box-shadow: inset 3px 0 0 var(--danger); }
.calendar-event.done { opacity: .67; }
.calendar-event.done .list-copy strong { text-decoration: line-through; }
.payment-summary { display: grid; grid-template-columns: repeat(3,1fr); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--surface-2); }
.payment-summary > div { padding: 14px; border-right: 1px solid var(--line); }
.payment-summary > div:last-child { border-right: 0; }
.payment-summary span { display: block; color: var(--muted); font-size: 8px; }
.payment-summary strong { display: block; margin-top: 6px; font-size: 13px; }
.transaction-list { margin-top: 16px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.transaction-row { min-height: 64px; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--line); }
.transaction-row:last-child { border-bottom: 0; }
.transaction-row strong { display: block; font-size: 11px; }
.transaction-row span { display: block; color: var(--muted); font-size: 8px; margin-top: 5px; }
.btn:disabled, button:disabled { opacity: .5; cursor: not-allowed; transform: none !important; }

@media (max-width: 880px) {
  .calendar-summary { grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
}
@media (max-width: 640px) {
  .calendar-summary { grid-template-columns: 1fr; }
  .calendar-day { grid-template-columns: 58px minmax(0,1fr); gap: 8px; }
  .calendar-date { min-height: 76px; border-radius: 13px; }
  .calendar-date strong { font-size: 19px; }
  .calendar-event { grid-template-columns: 34px minmax(0,1fr); padding: 11px; }
  .calendar-event > .badge { grid-column: 2; justify-self: start; }
  .payment-summary { grid-template-columns: 1fr; }
  .payment-summary > div { border-right: 0; border-bottom: 1px solid var(--line); }
  .payment-summary > div:last-child { border-bottom: 0; }
}


.theme-grid { display:grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-top: 14px; }
.theme-card { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 14px; padding: 14px; display:flex; flex-direction:column; align-items:flex-start; gap: 8px; min-height: 132px; transition:.18s ease; box-shadow: var(--shadow-sm); }
.theme-card:hover { transform: translateY(-1px); }
.theme-card.active { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(53,104,255,.12); background: var(--primary-soft); }
.theme-card svg { width: 20px; height: 20px; color: var(--primary); }
.theme-card strong { font-size: 11px; }
.theme-card small { color: var(--muted); font-size: 9px; line-height: 1.6; text-align:left; }
.setting-block { border: 1px solid var(--line); border-radius: 16px; background: var(--surface-2); padding: 16px; margin-bottom: 12px; }
.setting-block > strong { display:block; font-size: 11px; }
.setting-block > span { display:block; margin-top: 6px; color: var(--muted); font-size: 9px; }
body.compact-mode .page-content { padding: 20px 24px 34px; }
body.compact-mode .panel-head { min-height: 52px; }
body.compact-mode .panel-body { padding: 14px; }
body.compact-mode .stat-card { padding: 15px; }
body.compact-mode .chart-wrap { height: 250px; }
body.compact-mode .list-row { padding: 11px 15px; }
body.compact-mode .page-tools { margin-bottom: 14px; }

/* Operio v2.3 local update center */
.update-steps { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 12px; margin-top: 18px; }
.update-steps > div { position: relative; min-height: 112px; padding: 15px 14px 14px 52px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface-2); }
.update-steps > div > span { position: absolute; left: 14px; top: 14px; width: 27px; height: 27px; display: grid; place-items: center; border-radius: 9px; background: #e9efff; color: #315be8; font-size: 10px; font-weight: 800; }
.update-steps strong { display: block; font-size: 10px; }
.update-steps small { display: block; color: var(--muted); font-size: 8px; line-height: 1.55; margin-top: 7px; }
.warning-guide { margin-top: 16px; border-color: #efd6a1; background: #fff9eb; }
.button-spinner, .large-spinner { display: inline-block; border-radius: 50%; border-style: solid; animation: operio-spin .75s linear infinite; }
.button-spinner { width: 14px; height: 14px; border-width: 2px; border-color: rgba(255,255,255,.35); border-top-color: #fff; }
.large-spinner { width: 48px; height: 48px; border-width: 4px; border-color: #dfe6f8; border-top-color: #4264e8; }
@keyframes operio-spin { to { transform: rotate(360deg); } }
.update-restart-overlay { position: fixed; inset: 0; z-index: 1000; background: rgba(7,13,24,.72); backdrop-filter: blur(10px); display: grid; place-items: center; padding: 20px; }
.update-restart-card { width: min(460px,100%); border-radius: 22px; background: #fff; padding: 36px 30px; text-align: center; box-shadow: 0 30px 90px rgba(0,0,0,.28); }
.update-restart-card h2 { margin: 20px 0 8px; font-size: 20px; }
.update-restart-card p { color: var(--muted); font-size: 10px; line-height: 1.65; }
.update-restart-card small { display: block; margin-top: 16px; color: #8a5d0b; font-size: 8px; font-weight: 700; }

@media (max-width: 640px) {
  .theme-grid { grid-template-columns: 1fr; }
  .update-steps { grid-template-columns: 1fr; }
  .update-steps > div { min-height: 88px; }
}


/* Operio 3.0 — isolated chart legend (never drawn inside canvas) */
.chart-html-legend { display:grid; grid-template-columns:repeat(3,minmax(92px,auto)); align-items:center; justify-content:center; column-gap:20px; row-gap:9px; min-height:38px; margin:0 0 8px; }
.chart-legend-item { min-width:92px; height:30px; padding:0 11px; border:1px solid var(--line); border-radius:999px; background:var(--surface-2); display:grid; grid-template-columns:10px minmax(0,1fr); align-items:center; column-gap:8px; color:var(--muted); box-shadow:0 3px 10px rgba(16,30,54,.035); }
.chart-legend-item b { display:block; width:9px; height:9px; border-radius:50%; background:var(--legend-color); }
.chart-legend-item em { display:block; margin:0; padding:0; font-style:normal; font-size:10px; font-weight:800; line-height:1; white-space:nowrap; }
.chart-legend-item.tone-primary { --legend-color:var(--primary); }
.chart-legend-item.tone-warning { --legend-color:var(--warning); }
.chart-legend-item.tone-danger { --legend-color:var(--danger); }
.chart-legend-item.tone-muted { --legend-color:#c7d0df; }
.chart-wrap-with-legend { height:238px; }

/* Payment alert cards */
.payment-alert-row { position:relative; border-left:4px solid transparent; transition:.18s ease; background:linear-gradient(90deg,var(--payment-tint),transparent 58%); }
.payment-alert-row:hover { transform:translateX(2px); }
.payment-alert-overdue { --payment-tone:var(--danger); --payment-tint:var(--danger-soft); border-left-color:var(--danger); }
.payment-alert-today { --payment-tone:#d97b00; --payment-tint:#fff1d6; border-left-color:#f0a11e; }
.payment-alert-soon { --payment-tone:var(--warning); --payment-tint:var(--warning-soft); border-left-color:var(--warning); }
.payment-alert-planned { --payment-tone:var(--primary); --payment-tint:var(--primary-soft); border-left-color:#8ba5ff; }
.payment-alert-icon { color:var(--payment-tone); background:var(--payment-tint); }
.payment-deadline { display:flex; align-items:center; gap:5px; color:var(--payment-tone); font-size:8px; font-weight:800; margin-top:5px; }
.payment-deadline svg { width:11px; height:11px; }
.payment-alert-side { display:flex; align-items:center; gap:11px; }
.payment-mini-actions { display:flex; gap:5px; }
.payment-mini-actions .action-btn { width:30px; height:30px; background:var(--surface); }
body[data-theme="dark"] .payment-alert-today { --payment-tint:rgba(240,161,30,.15); }

/* Rayİst command center */
.rayist-hero { position:relative; overflow:hidden; min-height:230px; border-radius:24px; padding:30px; color:#fff; display:flex; align-items:center; justify-content:space-between; gap:28px; margin-bottom:18px; background:radial-gradient(circle at 82% 12%,rgba(255,255,255,.20),transparent 28%),linear-gradient(135deg,#071e4b 0%,#0b4fa8 52%,#0ba4d6 100%); box-shadow:0 24px 70px rgba(9,75,151,.25); }
.rayist-hero::after { content:""; position:absolute; width:360px; height:360px; border:1px solid rgba(255,255,255,.15); border-radius:50%; right:-110px; bottom:-225px; box-shadow:0 0 0 45px rgba(255,255,255,.035),0 0 0 90px rgba(255,255,255,.025); }
.rayist-hero-copy { position:relative; z-index:2; max-width:720px; }
.rayist-kicker { display:inline-flex; align-items:center; gap:8px; padding:7px 10px; border:1px solid rgba(255,255,255,.22); border-radius:999px; background:rgba(255,255,255,.10); font-size:9px; font-weight:800; text-transform:uppercase; letter-spacing:.7px; }
.rayist-kicker svg { width:15px; }
.rayist-hero h2 { font-size:30px; letter-spacing:-1px; margin:18px 0 8px; }
.rayist-hero p { max-width:680px; margin:0 0 22px; color:rgba(255,255,255,.75); font-size:12px; line-height:1.7; }
.rayist-admin-btn { background:#fff; color:#0a4b9e; box-shadow:0 10px 30px rgba(0,0,0,.16); }
.rayist-admin-btn:hover { transform:translateY(-1px); }
.rayist-hero .btn-secondary { background:rgba(255,255,255,.10); color:#fff; border-color:rgba(255,255,255,.20); }
.rayist-hero-mark { position:relative; z-index:2; width:190px; height:170px; border:1px solid rgba(255,255,255,.18); border-radius:28px; background:rgba(255,255,255,.09); backdrop-filter:blur(12px); display:flex; flex-direction:column; align-items:center; justify-content:center; text-align:center; padding:20px; transform:rotate(2deg); }
.rayist-hero-mark strong { width:72px; height:72px; border-radius:24px; background:#fff; color:#0b58b6; display:grid; place-items:center; font-size:35px; box-shadow:0 14px 34px rgba(0,0,0,.17); }
.rayist-hero-mark span { margin-top:14px; font-size:9px; line-height:1.5; color:rgba(255,255,255,.72); }
.rayist-stats { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:14px; margin-bottom:18px; }
.rayist-stat { background:var(--surface); border:1px solid var(--line); border-radius:16px; padding:17px; display:flex; justify-content:space-between; gap:12px; box-shadow:var(--shadow-sm); }
.rayist-stat span,.rayist-stat small { display:block; color:var(--muted); font-size:9px; }
.rayist-stat strong { display:block; margin:8px 0 5px; font-size:21px; letter-spacing:-.6px; }
.rayist-stat > svg { width:38px; height:38px; padding:10px; border-radius:12px; color:#0b67c8; background:rgba(11,103,200,.10); }
.rayist-grid { display:grid; grid-template-columns:minmax(0,1.35fr) minmax(340px,.85fr); gap:18px; }
.rayist-pipeline-summary { display:grid; grid-template-columns:repeat(5,1fr); gap:1px; background:var(--line); border-bottom:1px solid var(--line); }
.rayist-pipeline-summary div { background:var(--surface-2); padding:12px; text-align:center; }
.rayist-pipeline-summary span { display:block; color:var(--muted); font-size:8px; }
.rayist-pipeline-summary strong { display:block; font-size:16px; margin-top:5px; }
.rayist-lead-list,.rayist-work-list { display:grid; }
.rayist-lead-row { display:grid; grid-template-columns:38px minmax(0,1fr) auto auto; align-items:center; gap:12px; padding:14px 16px; border-bottom:1px solid var(--line); }
.rayist-lead-row:last-child,.rayist-work-row:last-child { border-bottom:0; }
.rayist-lead-row.urgent { background:linear-gradient(90deg,var(--warning-soft),transparent 55%); }
.rayist-lead-avatar { width:38px; height:38px; border-radius:12px; display:grid; place-items:center; background:linear-gradient(135deg,#0d4f9f,#11a7d8); color:#fff; font-size:10px; font-weight:800; }
.rayist-lead-copy,.rayist-work-copy { min-width:0; }
.rayist-lead-copy strong,.rayist-work-copy strong { display:block; font-size:11px; overflow-wrap:anywhere; }
.rayist-lead-copy span,.rayist-lead-copy small,.rayist-work-copy span,.rayist-work-copy small { display:block; color:var(--muted); font-size:8px; margin-top:4px; line-height:1.5; }
.rayist-lead-meta { display:flex; flex-direction:column; align-items:flex-end; gap:6px; }
.rayist-lead-meta b { font-size:10px; }
.rayist-mail-studio { background:linear-gradient(180deg,var(--surface),var(--surface-2)); }
.rayist-mail-body { min-height:235px; line-height:1.7; resize:vertical; }
.rayist-mail-actions { display:flex; justify-content:flex-end; gap:10px; margin-top:14px; }
.rayist-work-row { display:grid; grid-template-columns:32px minmax(0,1fr) auto; gap:10px; align-items:start; padding:14px 16px; border-bottom:1px solid var(--line); }
.rayist-work-row.overdue { background:linear-gradient(90deg,var(--danger-soft),transparent 55%); }
.rayist-work-row.done { opacity:.60; }
.rayist-work-row.done .rayist-work-copy strong { text-decoration:line-through; }
.rayist-work-check button { width:28px; height:28px; border:0; border-radius:9px; display:grid; place-items:center; background:var(--surface-2); color:var(--primary); }
.rayist-work-check svg { width:16px; }
.rayist-work-meta { display:flex; flex-direction:column; align-items:flex-end; gap:8px; }
.rayist-quick-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; }
.rayist-quick-card { border:1px solid var(--line); background:var(--surface-2); color:var(--text); border-radius:14px; padding:14px; text-align:left; display:flex; flex-direction:column; align-items:flex-start; gap:7px; min-height:125px; transition:.18s ease; }
.rayist-quick-card:hover { border-color:#8ea9ff; transform:translateY(-2px); box-shadow:var(--shadow-sm); }
.rayist-quick-card svg { width:20px; color:#0b67c8; }
.rayist-quick-card strong { font-size:10px; }
.rayist-quick-card span { color:var(--muted); font-size:8px; line-height:1.5; }
.rayist-empty { padding:34px 18px; }

@media (max-width:1180px) { .rayist-stats { grid-template-columns:repeat(2,1fr); } .rayist-grid { grid-template-columns:1fr; } }
@media (max-width:720px) { .chart-html-legend { gap:14px; justify-content:flex-start; } .chart-wrap-with-legend { height:220px; } .payment-alert-side { align-items:flex-end; flex-direction:column; } .payment-mini-actions { display:none; } .rayist-hero { padding:22px; min-height:auto; } .rayist-hero h2 { font-size:24px; } .rayist-hero-mark { display:none; } .rayist-stats { grid-template-columns:1fr 1fr; } .rayist-pipeline-summary { overflow-x:auto; grid-template-columns:repeat(5,minmax(100px,1fr)); } .rayist-lead-row { grid-template-columns:38px minmax(0,1fr) auto; } .rayist-lead-row > .actions { grid-column:2/4; justify-content:flex-end; } .rayist-lead-meta { align-items:flex-start; } .rayist-work-row { grid-template-columns:30px minmax(0,1fr); } .rayist-work-meta { grid-column:2; flex-direction:row; justify-content:space-between; align-items:center; } .rayist-quick-grid { grid-template-columns:1fr; } .rayist-mail-actions { flex-direction:column; } }

.reminder-icon-danger{background:var(--danger-soft);color:var(--danger)} .reminder-icon-warning{background:var(--warning-soft);color:var(--warning)} .reminder-icon-primary{background:var(--primary-soft);color:var(--primary)}

/* Operio 3.0 — Firebase sync, focus and quick notes */
.cloud-sync-chip { min-height:34px; border:1px solid var(--line); border-radius:999px; padding:0 11px; display:inline-flex; align-items:center; gap:7px; background:var(--surface); color:var(--muted); font-size:9px; font-weight:800; white-space:nowrap; box-shadow:0 4px 16px rgba(21,34,54,.04); }
.cloud-sync-chip svg { width:14px; height:14px; }
.cloud-sync-chip.cloud-synced,.cloud-sync-chip.cloud-ready { color:var(--success); background:var(--success-soft); border-color:rgba(22,166,106,.22); }
.cloud-sync-chip.cloud-syncing,.cloud-sync-chip.cloud-loading { color:var(--primary); background:var(--primary-soft); }
.cloud-sync-chip.cloud-offline { color:var(--warning); background:var(--warning-soft); }
.cloud-sync-chip.cloud-error { color:var(--danger); background:var(--danger-soft); }
.cloud-sync-chip.cloud-syncing svg,.cloud-sync-chip.cloud-loading svg { animation:spin .9s linear infinite; }
.logout-btn { color:var(--danger); }
.cloud-overview { display:flex; align-items:center; gap:14px; padding:16px; border:1px solid var(--line); border-radius:16px; background:linear-gradient(135deg,var(--surface-2),var(--surface)); margin-bottom:14px; }
.cloud-overview>div:last-child { min-width:0; }
.cloud-overview strong { display:block; font-size:12px; }
.cloud-overview span { display:block; color:var(--muted); font-size:9px; margin-top:5px; line-height:1.5; overflow-wrap:anywhere; }
.cloud-orb { width:44px; height:44px; flex:0 0 44px; border-radius:14px; display:grid; place-items:center; background:var(--primary-soft); color:var(--primary); }
.cloud-orb svg { width:21px; }
.cloud-orb.cloud-synced,.cloud-orb.cloud-ready { background:var(--success-soft); color:var(--success); }
.cloud-orb.cloud-error { background:var(--danger-soft); color:var(--danger); }
.firebase-config-form { margin-top:8px; }
.firebase-config-textarea { min-height:165px; font-family:ui-monospace,SFMono-Regular,Consolas,monospace; font-size:9px; line-height:1.55; }
.focus-banner { display:flex; align-items:center; gap:14px; min-height:72px; border:1px solid var(--line); border-radius:17px; padding:13px 16px; margin-bottom:18px; background:linear-gradient(100deg,var(--surface),var(--surface-2)); box-shadow:var(--shadow-sm); }
.focus-banner.attention { border-color:rgba(231,154,24,.30); background:linear-gradient(100deg,var(--warning-soft),var(--surface) 64%); }
.focus-banner.clear { border-color:rgba(22,166,106,.24); background:linear-gradient(100deg,var(--success-soft),var(--surface) 64%); }
.focus-icon { width:40px; height:40px; flex:0 0 40px; border-radius:13px; display:grid; place-items:center; background:var(--surface); color:var(--primary); box-shadow:var(--shadow-sm); }
.focus-banner.attention .focus-icon { color:var(--warning); }
.focus-banner.clear .focus-icon { color:var(--success); }
.focus-icon svg { width:19px; }
.focus-banner>div:nth-child(2) { min-width:0; flex:1; }
.focus-banner strong { display:block; font-size:12px; }
.focus-banner span { display:block; margin-top:4px; color:var(--muted); font-size:9px; }
.focus-actions { display:flex; align-items:center; gap:8px; }
.quick-note-list { display:grid; }
.quick-note-row { display:grid; grid-template-columns:28px minmax(0,1fr) auto; align-items:start; gap:10px; padding:13px 16px; border-bottom:1px solid var(--line); position:relative; }
.quick-note-row:last-child { border-bottom:0; }
.quick-note-row.pinned { background:linear-gradient(90deg,var(--primary-soft),transparent 62%); }
.quick-note-row>div:nth-child(2) { min-width:0; }
.quick-note-row strong { display:block; font-size:10px; }
.quick-note-row span { display:block; margin-top:5px; color:var(--muted); font-size:8px; line-height:1.55; overflow-wrap:anywhere; white-space:pre-wrap; }
.quick-note-pin { width:27px; height:27px; border:0; border-radius:9px; display:grid; place-items:center; background:var(--surface-2); color:var(--muted); }
.quick-note-row.pinned .quick-note-pin { background:var(--primary); color:#fff; }
.quick-note-pin svg { width:14px; }

/* Operio 3.0 — Rayİst advertising contracts */
.rayist-stats-six { grid-template-columns:repeat(3,minmax(0,1fr)); }
.rayist-contract-panel { overflow:visible; }
.rayist-contract-summary { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:1px; background:var(--line); border-bottom:1px solid var(--line); }
.rayist-contract-summary>div { padding:13px 15px; background:var(--surface-2); }
.rayist-contract-summary span { display:block; color:var(--muted); font-size:8px; }
.rayist-contract-summary strong { display:block; margin-top:6px; font-size:14px; overflow-wrap:anywhere; }
.rayist-contract-list { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; padding:14px; }
.rayist-contract-card { border:1px solid var(--line); border-radius:17px; padding:15px; background:linear-gradient(145deg,var(--surface),var(--surface-2)); box-shadow:var(--shadow-sm); min-width:0; position:relative; overflow:hidden; }
.rayist-contract-card::before { content:""; position:absolute; left:0; top:0; bottom:0; width:4px; background:var(--primary); }
.rayist-contract-card.expiring::before { background:var(--warning); }
.rayist-contract-card.expired::before { background:var(--danger); }
.rayist-contract-card.expiring { background:linear-gradient(145deg,var(--warning-soft),var(--surface) 62%); }
.rayist-contract-card.expired { background:linear-gradient(145deg,var(--danger-soft),var(--surface) 62%); }
.rayist-contract-head { display:flex; justify-content:space-between; gap:12px; align-items:flex-start; }
.rayist-contract-head>div:first-child { min-width:0; }
.rayist-contract-type { color:#0b67c8; font-size:8px; font-weight:850; text-transform:uppercase; letter-spacing:.5px; }
.rayist-contract-head h3 { margin:6px 0 0; font-size:13px; letter-spacing:-.2px; overflow-wrap:anywhere; }
.rayist-contract-head p { margin:5px 0 0; color:var(--muted); font-size:8px; }
.rayist-contract-badges { display:flex; flex-wrap:wrap; justify-content:flex-end; gap:5px; }
.rayist-contract-dates { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-top:14px; color:var(--muted); font-size:8px; }
.rayist-contract-dates span { display:flex; align-items:center; gap:6px; }
.rayist-contract-dates svg { width:13px; }
.rayist-contract-dates strong { color:var(--text); font-size:8px; }
.rayist-contract-progress { margin-top:8px; height:6px; }
.rayist-contract-finance { display:grid; grid-template-columns:repeat(4,minmax(0,1fr)); gap:8px; margin-top:14px; }
.rayist-contract-finance>div { min-width:0; padding:9px; border-radius:11px; background:var(--surface); border:1px solid var(--line); }
.rayist-contract-finance span { display:block; color:var(--muted); font-size:7px; }
.rayist-contract-finance strong { display:block; margin-top:5px; font-size:9px; overflow-wrap:anywhere; }
.rayist-contract-deliverables { display:flex; align-items:flex-start; gap:7px; margin:12px 0 0; padding:10px; border-radius:11px; background:var(--surface); color:var(--muted); font-size:8px; line-height:1.55; }
.rayist-contract-deliverables svg { width:14px; flex:0 0 14px; color:var(--success); }
.rayist-contract-actions { display:flex; justify-content:space-between; gap:10px; align-items:center; margin-top:12px; }
.modal-lg { width:min(850px,100%); }

.auth-loading { min-height:100vh; display:grid; place-items:center; padding:24px; background:var(--bg); }
.auth-loading-card { width:min(420px,100%); padding:34px; border:1px solid var(--line); border-radius:22px; background:var(--surface); text-align:center; box-shadow:var(--shadow-md); }
.auth-loading-card .large-spinner { margin:0 auto 18px; }
.auth-loading-card h2 { margin:0; font-size:18px; }
.auth-loading-card p { color:var(--muted); font-size:10px; line-height:1.65; }

@media(max-width:1180px){.rayist-stats-six{grid-template-columns:repeat(2,1fr)}.rayist-contract-list{grid-template-columns:1fr}}
@media(max-width:820px){.cloud-sync-chip span{display:none}.cloud-sync-chip{width:40px;height:40px;padding:0;justify-content:center;border-radius:12px}.logout-btn{display:none}.focus-banner{align-items:flex-start;flex-wrap:wrap}.focus-actions{width:100%;padding-left:54px}.rayist-contract-summary{grid-template-columns:1fr 1fr}.rayist-contract-finance{grid-template-columns:1fr 1fr}.chart-html-legend{grid-template-columns:repeat(3,minmax(82px,1fr));column-gap:7px}.chart-legend-item{min-width:0;padding:0 8px}}
@media(max-width:540px){.rayist-stats-six{grid-template-columns:1fr 1fr}.rayist-contract-list{padding:10px}.rayist-contract-head{flex-direction:column}.rayist-contract-badges{justify-content:flex-start}.focus-actions{padding-left:0}.chart-html-legend{grid-template-columns:1fr;justify-items:stretch}.chart-legend-item{width:100%}.chart-wrap-with-legend{height:225px}}

input, select, textarea { color-scheme: light; }
body[data-theme="dark"] input, body[data-theme="dark"] select, body[data-theme="dark"] textarea { color-scheme: dark; }
@media(max-width:480px){
  .topbar{padding:0 10px}
  .topbar-left{gap:7px;min-width:0}
  .page-heading{min-width:0}
  .page-heading h1{font-size:15px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:150px}
  .top-actions{gap:5px}
  .top-actions [data-action="cycle-theme"]{display:none}
  .icon-btn,.cloud-sync-chip{width:38px;height:38px}
}
