/* Screens: the mines list and the workspace (plan beside the 3D nest). */

.topbar {
  flex-shrink: 0; height: 56px; display: flex; align-items: center; gap: 14px; padding: 0 16px;
  background: var(--navy); color: #fff;
}
.brand { display: flex; align-items: baseline; gap: 8px; text-decoration: none; color: inherit; }
.brand b { font-weight: 800; font-size: 20px; letter-spacing: -0.02em; }
.brand span { font-size: 13px; font-weight: 500; color: #B8C6DD; }
.topbar .sep { width: 1px; height: 24px; background: rgba(255,255,255,0.2); }
.topbar .ghost {
  height: 36px; padding: 0 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,0.22);
  background: transparent; color: #fff; font-weight: 500; font-size: 13px; display: inline-flex; align-items: center; gap: 6px;
}
.topbar .ghost:hover:not(:disabled) { background: rgba(255,255,255,0.08); }
.topbar .ghost.icon-only { width: 36px; padding: 0; justify-content: center; }
.topbar .mine-name { font-weight: 600; font-size: 14px; border: 0; }
.spacer { flex: 1; }
.status-pill { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 10px; border-radius: 999px; font-size: 12px; font-weight: 600; border: 0; }
.status-pill.ok { background: rgba(0,184,200,0.18); color: #A5EEF4; }
.status-pill.warn { background: rgba(231,181,74,0.22); color: #F8DFA6; }
.save-state { font-size: 12px; color: #B8C6DD; min-width: 52px; }

.search { position: relative; flex: 0 1 340px; min-width: 200px; }
.search .icon { position: absolute; left: 11px; top: 10px; width: 16px; height: 16px; color: #B8C6DD; pointer-events: none; }
.search input {
  width: 100%; height: 36px; padding: 0 12px 0 34px; border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.24); background: rgba(255,255,255,0.1); color: #fff; outline: none;
}
.search input::placeholder { color: #B8C6DD; }
.suggestions {
  position: absolute; top: 42px; left: 0; right: 0; z-index: 40; background: #fff; color: var(--ink);
  border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); padding: 4px;
}
.suggestions button {
  display: flex; width: 100%; align-items: center; justify-content: space-between; gap: 10px;
  height: 36px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; text-align: left; font-size: 13px;
}
.suggestions button:hover, .suggestions button.active { background: var(--soft); }
.suggestions b { font-weight: 600; }
.suggestions span { font-size: 12px; color: var(--muted); }

/* Mines list. */
.page { min-height: 100%; display: flex; flex-direction: column; }
.mines { width: 100%; max-width: 980px; margin: 0 auto; padding: 28px 16px 48px; display: flex; flex-direction: column; gap: 18px; }
.mines h1 { margin: 0; font-size: 24px; letter-spacing: -0.01em; }
.mines .lead { margin: 4px 0 0; color: var(--body); max-width: 640px; }
.mines .actions { display: flex; flex-wrap: wrap; gap: 8px; }
.mine-list { display: flex; flex-direction: column; gap: 10px; }
.mine-card {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 16px; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.mine-card .info { flex: 1; min-width: 220px; }
.mine-card h2 { margin: 0; font-size: 16px; }
.mine-card .meta { margin-top: 3px; font-size: 13px; color: var(--muted); }
.empty { padding: 28px; text-align: center; color: var(--muted); background: var(--card); border: 1px dashed var(--line-strong); border-radius: 12px; }

/* Workspace. */
.workspace { position: relative; height: 100vh; min-height: 520px; display: flex; flex-direction: column; overflow: hidden; }
.levelbar {
  flex-shrink: 0; min-height: 50px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 6px 16px;
  background: var(--card); border-bottom: 1px solid var(--line);
}
.label-caps { font-size: 11px; font-weight: 800; letter-spacing: 0.1em; color: var(--navy); }
.levelbar .label-caps { color: var(--muted); letter-spacing: 0.06em; font-weight: 700; font-size: 12px; }
.levelbar .seg button { height: 34px; min-width: 58px; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--body); cursor: pointer; }
.check input { width: 16px; height: 16px; margin: 0; accent-color: var(--navy); }

.ws-body { flex: 1; min-height: 0; display: flex; }
.rail { flex-shrink: 0; width: 66px; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 10px 0; background: var(--card); border-right: 1px solid var(--line); overflow-y: auto; }
.rail button {
  width: 54px; height: 54px; flex-shrink: 0; border-radius: 10px; border: 0; background: transparent; color: var(--label);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-weight: 600; font-size: 10.5px;
}
.rail button .icon { width: 20px; height: 20px; stroke-width: 1.8; }
.rail button:hover { background: var(--soft); }
.rail button[aria-pressed="true"] { background: var(--blue-soft); color: var(--navy); }

.plan { flex: 0 0 42%; min-width: 360px; max-width: 660px; display: flex; flex-direction: column; background: var(--card); border-right: 1px solid var(--line); }
.pane-head { flex-shrink: 0; height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 10px 0 14px; border-bottom: 1px solid #EEF2F6; }
.pane-head .title { font-size: 13px; font-weight: 600; }
.pane-head .btn.icon-only { width: 34px; height: 34px; font-size: 17px; border-color: var(--line); color: var(--body); }
.plan-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; outline: none; }
.plan-wrap canvas, .nest-wrap canvas { position: absolute; left: 0; top: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.plan-hint { position: absolute; left: 12px; right: 12px; bottom: 10px; font-size: 12px; color: var(--muted); pointer-events: none; text-align: center; }

.extend-box {
  position: absolute; z-index: 20; width: 276px; padding: 14px; display: flex; flex-direction: column; gap: 10px;
  background: var(--card); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow);
}
.extend-box .head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.extend-box .head b { font-size: 14px; }
.extend-box .head span { font-size: 12px; color: var(--muted); }
.extend-box .grads { display: flex; flex-wrap: wrap; gap: 6px; }
.extend-box .grads button { height: 30px; padding: 0 10px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--card); color: var(--body); font-weight: 600; font-size: 12px; }
.extend-box .grads button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.extend-box .summary { font-size: 12px; color: var(--body); background: var(--page); border-radius: 8px; padding: 8px 10px; }
.extend-box .buttons { display: flex; justify-content: flex-end; gap: 8px; }

.nest { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nest-tools { flex-shrink: 0; min-height: 50px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; padding: 7px 14px; background: var(--card); border-bottom: 1px solid var(--line); }
.nest-tools select { height: 32px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--card); font-size: 13px; }
.nest-tools .toggles { display: flex; flex-wrap: wrap; gap: 6px; }
.nest-wrap { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--nest-bg); }
.nest-note { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding: 24px; text-align: center; color: var(--label); }

.legend {
  position: absolute; z-index: 10; left: 12px; bottom: 12px; max-width: 250px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 5px; background: rgba(255,255,255,0.95); border: 1px solid var(--line); border-radius: 12px;
}
.legend .t { font-size: 12px; font-weight: 700; }
.legend .s { font-size: 11px; color: var(--muted); margin-top: -3px; }
.legend .row { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--body); }
.legend .sw { flex-shrink: 0; width: 22px; height: 10px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(15,23,42,0.12); }
.legend .sw.thin { height: 4px; opacity: 0.75; }
.legend .sw.stripe { background: repeating-linear-gradient(135deg, #8A3B1C 0 3px, #F1DCCF 3px 6px); }
.legend .sw.cone { height: 10px; box-shadow: none; background: #1B5AA3; clip-path: polygon(0 20%, 100% 50%, 0 80%); }

.view-buttons { position: absolute; z-index: 10; right: 12px; bottom: 12px; display: flex; gap: 6px; align-items: center; }
.view-buttons .btn { height: 36px; }
.view-buttons label { display: inline-flex; align-items: center; gap: 4px; height: 36px; padding: 0 4px 0 10px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--card); font-size: 12px; font-weight: 600; color: var(--body); }
.view-buttons select { height: 30px; border: 0; background: transparent; font-weight: 600; font-size: 13px; }

.panel {
  position: absolute; z-index: 15; top: 12px; right: 12px; width: 356px; max-height: calc(100% - 76px); overflow-y: auto;
  background: var(--card); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.panel .p-head { display: flex; align-items: flex-start; gap: 10px; padding: 14px 12px 12px 16px; border-bottom: 1px solid #EEF2F6; }
.panel .p-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.panel .p-meta { margin-top: 3px; font-size: 12.5px; color: var(--label); }
.panel .close { flex-shrink: 0; width: 36px; height: 36px; border-radius: 8px; border: 0; background: var(--soft); color: var(--body); display: inline-flex; align-items: center; justify-content: center; }
.panel .p-body { display: flex; flex-direction: column; gap: 14px; padding: 12px 16px 16px; }
.panel .nums { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px 18px; }
.panel .k { font-size: 12px; color: var(--muted); }
.panel .big { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; }
.panel .big.nr { font-size: 20px; }
.panel .unit { font-size: 13px; color: var(--label); margin-left: 5px; }
.panel .v { font-size: 16px; font-weight: 700; }
.panel .band { align-self: flex-start; display: inline-flex; align-items: center; gap: 8px; min-height: 26px; padding: 2px 10px; border-radius: 999px; background: var(--soft); font-size: 12px; font-weight: 600; color: var(--body); }
.panel .band i { flex-shrink: 0; width: 12px; height: 12px; border-radius: 3px; box-shadow: inset 0 0 0 1px rgba(15,23,42,0.15); }
.panel h3 { margin: 0 0 6px; font-size: 12px; font-weight: 700; color: var(--body); }
.shifts { display: flex; flex-direction: column; gap: 6px; overflow-x: auto; }
.shifts .r { display: flex; align-items: center; gap: 6px; min-width: min-content; }
.shifts .lab { width: 40px; flex-shrink: 0; font-size: 11px; color: var(--muted); }
.shifts .day { flex: 1 0 78px; font-size: 11px; font-weight: 600; color: var(--muted); }
.shifts .cell { flex: 1 0 78px; height: 40px; display: flex; align-items: flex-end; gap: 2px; padding: 3px; border-radius: 6px; background: var(--soft); }
.shifts .cell.out { opacity: 0.35; }
.shifts .cell span { flex: 1; min-width: 0; border-radius: 2px; }
.shifts .key { padding-left: 46px; font-size: 11px; color: var(--muted); display: flex; align-items: center; gap: 5px; }
.shifts .key i { width: 10px; height: 3px; border-radius: 1px; background: var(--line-strong); }
.machine-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 7px 0; border-top: 1px solid var(--soft); }
.machine-row .name { flex: 1; min-width: 120px; font-size: 13px; }
.machine-row .name span { color: var(--muted); }
.tag { font-size: 12px; font-weight: 600; padding: 3px 8px; border-radius: 999px; }
.tag.close { background: var(--navy); color: #fff; }
.tag.near { background: #DBE7F6; color: var(--navy); }
.tag.area { background: var(--soft); color: var(--body); }
.note { font-size: 12.5px; color: var(--body); background: var(--page); border-radius: 8px; padding: 8px 10px; }
.fine { font-size: 11.5px; color: var(--muted); }

.footer {
  flex-shrink: 0; min-height: 56px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 14px; padding: 8px 16px;
  background: var(--card); border-top: 1px solid var(--line);
}
.footer .sel-title { font-size: 14px; font-weight: 700; }
.footer .sel-meta { flex: 1; min-width: 220px; font-size: 13px; color: var(--label); }
.footer .actions { display: flex; flex-wrap: wrap; gap: 8px; }

.toast {
  position: absolute; z-index: 60; left: 50%; transform: translateX(-50%); top: 204px;
  width: max-content; max-width: calc(100% - 32px); padding: 10px 14px; border-radius: 10px;
  background: var(--ink); color: #fff; font-size: 13px; box-shadow: 0 10px 28px rgba(15,23,42,0.28);
  display: flex; align-items: center; gap: 12px;
}
.toast button { border: 0; background: transparent; color: #9EC9F5; font-weight: 700; font-size: 13px; padding: 0; }

.problem-list { display: flex; flex-direction: column; gap: 6px; max-height: 50vh; overflow-y: auto; }
.problem-list button { text-align: left; border: 1px solid var(--line); background: var(--card); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.problem-list button b { color: var(--danger); margin-right: 6px; }
.problem-list button b.warning { color: #92400E; }

/* Lists in dialogs (beacons & machines, levels). */
dialog.app-dialog.wide { max-width: min(860px, calc(100vw - 32px)); }
.list-head { margin: 4px 0 -4px; font-size: 13px; color: var(--ink); }
.list-table { display: grid; gap: 0 12px; align-items: center; max-height: 40vh; overflow-y: auto; font-size: 13px; }
.list-table > * { padding: 7px 0; border-bottom: 1px solid var(--soft); min-width: 0; }
.list-table .th { font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; position: sticky; top: 0; background: var(--card); }
.list-table.beacons { grid-template-columns: 56px minmax(0, 1fr) 150px 64px auto; }
.list-table.machines { grid-template-columns: 70px 110px minmax(0, 1fr) 70px auto; }
.list-table.levels { grid-template-columns: minmax(0, 1fr) 110px auto; }
.list-table.levels input { width: 100%; height: 34px; padding: 0 8px; border-radius: 8px; border: 1px solid var(--line-strong); font-weight: 600; }
.list-table .removed input { text-decoration: line-through; opacity: 0.5; }
.muted-cell { color: var(--label); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-buttons { display: flex; gap: 6px; justify-content: flex-end; }
.tag.quiet { background: #FDEBDD; color: #9A3412; margin-left: 6px; }
.tag.never { background: var(--soft); color: var(--label); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace !important; font-size: 12px !important; }
.app-dialog .check { margin-top: 2px; }

/* Phone width: the nest only, view only. */
.phone-note { position: absolute; z-index: 9; left: 10px; top: 10px; padding: 6px 10px; border-radius: 999px; background: rgba(255,255,255,0.92); border: 1px solid var(--line); font-size: 12px; color: var(--label); }
@media (max-width: 759px) {
  .workspace .levelbar, .workspace .rail, .workspace .plan, .workspace .footer, .topbar .wide { display: none !important; }
  .topbar { gap: 8px; padding: 0 8px 0 14px; }
  .topbar .search { flex: 1; min-width: 0; }
  .search input { height: 40px; font-size: 16px; }
  .nest-tools { flex-wrap: nowrap; overflow-x: auto; padding: 8px 12px; scrollbar-width: none; }
  .nest-tools::-webkit-scrollbar { display: none; }
  .nest-tools .wide { display: none; }
  .nest-tools .seg button, .nest-tools select { height: 40px; flex-shrink: 0; }
  .panel { top: auto; right: 0; left: 0; bottom: 0; width: auto; max-height: 62%; border-radius: 18px 18px 0 0; }
  .legend { left: 10px; bottom: 10px; max-width: 190px; padding: 8px 10px; }
  .panel:not([hidden]) ~ .legend { display: none; }
  .view-buttons { top: 10px; bottom: auto; right: 10px; }
  .view-buttons label { display: none; }
  .view-buttons .btn { height: 40px; }
  .toast { top: auto; bottom: 24px; }
}
@media (min-width: 760px) { .phone-note { display: none; } }
