/* Back office layout */
.ic { width: 18px; height: 18px; flex: none; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.login-art { position: relative; overflow: hidden; background: radial-gradient(circle at 85% 15%, #4a4f9a 0%, transparent 45%), linear-gradient(150deg, var(--brand) 0%, var(--brand-2) 60%, var(--primary) 100%); color: #fff; padding: 48px; display: flex; flex-direction: column; justify-content: space-between; }
.login-art > * { position: relative; }
.login-art .rings { position: absolute; width: 620px; height: 620px; right: -180px; bottom: -200px; }
.login-art .logo-full { width: 260px; height: auto; }
.login-art h1 { font-size: 30px; margin-top: 24px; max-width: 420px; }
.logo-full { display: block; height: auto; max-width: 100%; }
.login-art p { color: #c9cbe3; max-width: 420px; font-size: 15px; }
.login-art ul { padding: 0; list-style: none; color: #dbe5f3; display: grid; gap: 10px; }
.login-art li { display: flex; gap: 10px; align-items: center; }
.login-form { display: flex; align-items: center; justify-content: center; padding: 32px 16px; background: var(--surface); }
.login-form form { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: .02em; }
.brand img { width: 38px; height: 38px; }
.brand small { display: block; font-weight: 500; font-size: 11px; letter-spacing: .08em; opacity: .75; text-transform: uppercase; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--brand); color: #c9cbe3; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side .brand { color: #fff; padding: 20px 20px 16px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.side .brand .logo-full { width: 176px; }
.side nav { padding: 10px 10px; display: flex; flex-direction: column; gap: 2px; flex: 1; }
.side nav a { position: relative; display: flex; align-items: center; gap: 11px; padding: 9px 12px; border-radius: 8px; color: #c9cbe3; font-weight: 500; text-decoration: none; transition: background .15s, color .15s, padding-left .15s; }
.side nav a::before { content: ""; position: absolute; left: 0; top: 8px; bottom: 8px; width: 3px; border-radius: 3px; background: #8f9cff; transform: scaleY(0); transition: transform .2s ease; }
.side nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; padding-left: 15px; }
.side nav a.active { background: rgba(255, 255, 255, .13); color: #fff; }
.side nav a.active::before { transform: scaleY(1); }
.side nav .sep { margin: 12px 12px 4px; font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #8e90b5; }
.side .foot { padding: 14px 18px; font-size: 12px; color: #8e90b5; border-top: 1px solid rgba(255, 255, 255, .08); }
.side .foot a { color: #c9cbe3; }
.side nav .sep { color: #8e90b5; }

.main-col { min-width: 0; display: flex; flex-direction: column; }
.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 12px; padding: 0 24px; height: 60px; background: rgba(255, 255, 255, .92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--border); }
.top .menu-btn { display: none; }
.top .title { font-weight: 650; font-size: 16px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-btn { position: relative; width: 38px; height: 38px; border-radius: 50%; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; cursor: pointer; color: var(--text-2); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn .dot { position: absolute; top: 4px; right: 3px; min-width: 17px; height: 17px; padding: 0 4px; border-radius: 9px; background: var(--accent); color: #fff; font-size: 10.5px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.user-chip { display: flex; align-items: center; gap: 9px; padding: 4px 6px 4px 4px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); cursor: pointer; font: inherit; }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--primary-soft); color: var(--primary); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; flex: none; }
.user-chip .who { text-align: left; line-height: 1.15; }
.user-chip .who small { display: block; color: var(--muted); font-size: 11px; }
.dropdown { position: absolute; top: 54px; right: 16px; width: 360px; max-height: 70vh; overflow-y: auto; background: var(--surface); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-lg); z-index: 50; }
.dropdown .item { display: block; padding: 11px 14px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none; cursor: pointer; }
.dropdown .item:hover { background: var(--surface-2); }
.dropdown .item.unread { background: #f3f7fd; }
.dropdown .item b { display: block; font-weight: 600; }
.dropdown .menu-item { display: flex; gap: 10px; align-items: center; width: 100%; padding: 11px 14px; border: 0; background: none; font: inherit; color: var(--text); cursor: pointer; text-align: left; }
.dropdown .menu-item:hover { background: var(--surface-2); }

#main { padding: 24px; max-width: 1400px; width: 100%; }
.page-h { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; flex-wrap: wrap; }
.page-h .sub { color: var(--muted); margin-top: 3px; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.filters input, .filters select { width: auto; min-width: 140px; min-height: 34px; padding: 6px 10px; }
.filters input[type=search] { min-width: 220px; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); padding: 0 12px; overflow-x: auto; }
.tabs button { border: 0; background: none; font: inherit; font-weight: 550; color: var(--muted); padding: 12px 12px; border-bottom: 2px solid transparent; cursor: pointer; white-space: nowrap; }
.tabs button.active { color: var(--primary); border-bottom-color: var(--primary); }
.tabs .count { background: #eceef2; color: var(--text-2); border-radius: 999px; padding: 0 7px; font-size: 11.5px; margin-left: 4px; }

/* ---------- dashboard ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; margin-bottom: 18px; }
.tile { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); text-decoration: none !important; color: var(--text); display: block; }
.tile:hover { border-color: var(--border-strong); }
.tile .lbl { font-size: 12.5px; color: var(--muted); font-weight: 550; display: flex; align-items: center; gap: 6px; }
.tile .val { font-size: 28px; font-weight: 650; margin-top: 4px; line-height: 1.1; }
.tile .val small { font-size: 14px; color: var(--muted); font-weight: 500; }
.tile.alert-tile .val { color: var(--danger); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; align-items: start; }
.grid-2e { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.list-item { display: flex; gap: 12px; align-items: flex-start; padding: 11px 16px; border-bottom: 1px solid var(--border); color: var(--text); text-decoration: none !important; }
.list-item:last-child { border-bottom: 0; }
a.list-item:hover { background: var(--surface-2); }
.list-item .main { flex: 1; min-width: 0; }
.list-item .main b { font-weight: 600; }
.list-item .meta { color: var(--muted); font-size: 12.5px; }
.team-row { display: flex; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--border); }
.team-row:last-child { border-bottom: 0; }
.st-dot { width: 9px; height: 9px; border-radius: 50%; background: #c3c8d1; flex: none; }
.st-dot.busy { background: #6c5ce7; }
.st-dot.free { background: #12a150; }

/* ---------- detail ---------- */
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: start; }
.detail-grid > div { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.head-card { padding: 18px 20px; }
.head-card .ref { font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.head-card h1 { margin: 4px 0 10px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }
.section-title { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); font-weight: 650; margin: 14px 0 8px; }
.visit { display: flex; justify-content: space-between; gap: 8px; padding: 9px 0; border-bottom: 1px dashed var(--border); }
.visit:last-child { border-bottom: 0; }

/* ---------- pickers ---------- */
.assignees { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.assignee { display: flex; align-items: center; gap: 9px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 8px; cursor: pointer; }
.assignee:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.assignee .load { margin-left: auto; font-size: 11.5px; color: var(--muted); }
.item-row { display: grid; grid-template-columns: 1fr 90px 90px 34px; gap: 8px; margin-bottom: 8px; }

/* ---------- schedule ---------- */
.sched { display: grid; border-top: 1px solid var(--border); min-width: 860px; }
.sched .cell { border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; min-height: 76px; }
.sched .hdr { background: var(--surface-2); font-weight: 600; font-size: 12.5px; min-height: 0; padding: 8px; text-align: center; }
.sched .hdr.today { background: var(--primary-soft); color: var(--primary); }
.sched .who { font-weight: 600; font-size: 13px; padding: 10px; background: var(--surface-2); }
.sched .who small { display: block; font-weight: 400; color: var(--muted); }
.sched .chip { display: block; padding: 5px 7px; border-radius: 6px; margin-bottom: 4px; font-size: 12px; line-height: 1.3; text-decoration: none !important; border-left: 3px solid; }
.chip.k-installation { background: #e8f0fc; border-color: #2a78d6; color: #3a3d6b; }
.chip.k-support { background: #fdeee6; border-color: #eb6834; color: #7a2f10; }
.chip.k-maintenance { background: #e3f6ee; border-color: #1baf7a; color: #0d5a3e; }
.chip.k-other, .chip.k-survey { background: #efedf9; border-color: #4a3aa7; color: #2e236e; }
.chip.done { opacity: .6; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--text-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }

/* ---------- CRM pipeline ---------- */
.crm-board { display: flex; gap: 12px; overflow-x: auto; align-items: flex-start; padding-bottom: 6px; }
.crm-col { flex: 0 0 260px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; min-height: 140px; }
.crm-col.drop { outline: 2px dashed var(--primary); outline-offset: -2px; }
.crm-col-h { display: flex; justify-content: space-between; gap: 6px; font-weight: 600; margin-bottom: 8px; }
.crm-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 9px 10px; margin-bottom: 8px; cursor: pointer; box-shadow: var(--shadow); }
.crm-card:hover { border-color: var(--border-strong); }

@media (max-width: 1100px) {
  .detail-grid, .grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; left: 0; top: 0; bottom: 0; width: 260px; z-index: 60; transform: translateX(-100%); transition: transform .2s; }
  .shell.nav-open .side { transform: none; box-shadow: var(--shadow-lg); }
  .top { padding: 0 12px; }
  .top .menu-btn { display: inline-flex; }
  .user-chip .who { display: none; }
  #main { padding: 16px; }
  .grid-2e { grid-template-columns: 1fr; }
  .login-wrap { grid-template-columns: 1fr; }
  .login-art { display: none; }
  .dropdown { left: 8px; right: 8px; width: auto; }
  .filters input[type=search] { min-width: 0; flex: 1; }
}
@media print {
  .side, .top, .no-print { display: none !important; }
  .shell { display: block; }
  #main { padding: 0; }
}

/* ---------- projects: work flow stepper ---------- */
.flow-wrap { overflow-x: auto; padding: 4px 2px 2px; }
.flow { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); min-width: 720px; }
.flow .st { position: relative; text-align: center; padding: 0 4px 4px; border-radius: 10px; }
.flow .st::before { content: ""; position: absolute; top: 16px; right: 50%; width: 100%; height: 3px; background: #e2e5ea; z-index: 0; }
.flow .st:first-child::before { display: none; }
.flow .st.done::before, .flow .st.in_progress::before { background: linear-gradient(90deg, var(--success), var(--success)); }
.flow .dot { position: relative; z-index: 1; width: 34px; height: 34px; margin: 0 auto 7px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; background: #eef0f4; color: #5b6270; border: 3px solid var(--surface); box-shadow: 0 0 0 1px #dfe2e8; transition: transform .15s; }
.flow .st.done .dot { background: var(--success); color: #fff; box-shadow: 0 0 0 1px var(--success); }
.flow .st.in_progress .dot { background: var(--primary); color: #fff; box-shadow: 0 0 0 1px var(--primary); }
.flow .st.na .dot { background: #f5f5f5; color: #b5b5b5; }
.flow .st.current .dot { box-shadow: 0 0 0 4px rgba(59, 79, 184, .22); }
.flow .lbl { font-size: 12px; font-weight: 600; line-height: 1.3; }
.flow .st.na .lbl { color: var(--muted); text-decoration: line-through; }
.flow .date { font-size: 11px; color: var(--muted); margin-top: 2px; min-height: 14px; }
.flow .st.clickable { cursor: pointer; }
.flow .st.clickable:hover { background: var(--surface-2); }
.flow .st.clickable:hover .dot { transform: scale(1.08); }
