:root {
  color-scheme: dark;
  --bg: #080d13;
  --panel: #101821;
  --panel-2: #151f2a;
  --panel-3: #1b2834;
  --line: #283746;
  --line-strong: #3c5163;
  --text: #eef5f7;
  --muted: #8da0ad;
  --accent: #4dd6b0;
  --accent-2: #3ab0db;
  --accent-dark: #163a36;
  --warning: #f3b65d;
  --danger: #ef6b72;
  --shadow: 0 18px 55px rgba(0, 0, 0, .32);
  --radius: 16px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: radial-gradient(circle at 70% -10%, #16303b 0, transparent 34rem), var(--bg); color: var(--text); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.spacer { flex: 1; }
.full { width: 100%; }
.full-span { grid-column: 1 / -1; }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(430px, 100%); display: grid; gap: 15px; padding: 32px; border: 1px solid var(--line); border-radius: 20px; background: rgba(16, 24, 33, .96); box-shadow: var(--shadow); }
.login-card h1 { margin: 4px 0 0; font-size: 30px; }
.login-card p { color: var(--muted); line-height: 1.5; }
.large-mark { width: 58px; height: 58px; font-size: 18px; }
.form-error { min-height: 18px; margin: 0; color: #ff9ca2 !important; font-size: 12px; }

.app-header { height: 68px; padding: 0 26px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid rgba(80, 108, 128, .35); background: rgba(8, 13, 19, .86); backdrop-filter: blur(18px); position: sticky; top: 0; z-index: 50; }
.brand { appearance: none; border: 0; background: none; color: var(--text); display: flex; align-items: center; gap: 11px; text-align: left; cursor: pointer; }
.brand-mark { width: 39px; height: 39px; display: grid; place-items: center; border: 1px solid #4fd0af; border-radius: 12px; background: linear-gradient(145deg, #17362f, #12212b); color: #7cf0d0; font-weight: 800; letter-spacing: -.04em; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; letter-spacing: .01em; }
.brand small { color: var(--muted); margin-top: 2px; font-size: 11px; }
.header-status { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 13px; }
.user-chip { display: grid; gap: 1px; padding: 5px 10px; color: var(--text); text-align: right; border: 1px solid var(--line); border-radius: 10px; background: #101923; cursor: pointer; }
.user-chip small { color: var(--muted); font-size: 10px; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 14px currentColor; }
.status-dot.online { background: var(--accent); }
.status-dot.error { background: var(--danger); }

main { min-height: calc(100vh - 68px); }
.view { max-width: 1600px; margin: 0 auto; padding: 34px 30px 48px; }
.hero-row { display: flex; align-items: end; justify-content: space-between; gap: 30px; margin-bottom: 30px; }
.eyebrow { color: #72dbbf; text-transform: uppercase; letter-spacing: .13em; font-size: 11px; font-weight: 800; }
h1, h2, h3, p { margin-top: 0; }
h1 { font-size: clamp(28px, 4vw, 47px); margin: 8px 0 10px; letter-spacing: -.045em; line-height: 1.05; }
h2 { font-size: 21px; letter-spacing: -.02em; }
h3 { margin-bottom: 10px; }
.hero-row p { color: var(--muted); font-size: 16px; max-width: 760px; margin-bottom: 0; }

.button { min-height: 40px; padding: 9px 15px; border-radius: 10px; border: 1px solid var(--line); color: var(--text); background: var(--panel-2); cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 8px; transition: transform .15s, border-color .15s, background .15s; }
.button:hover { border-color: var(--line-strong); background: var(--panel-3); }
.button:active { transform: translateY(1px); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.primary { color: #051510; background: linear-gradient(135deg, #64e2c0, #3bbd9e); border-color: transparent; font-weight: 800; box-shadow: 0 8px 26px rgba(61, 198, 161, .15); }
.button.primary:hover { background: linear-gradient(135deg, #78ebca, #49caaa); }
.button.secondary { background: var(--accent-dark); border-color: #2c6f61; color: #b6f4e1; }
.button.ghost { background: transparent; }
.button.danger { border-color: #703b43; color: #ffb4b8; background: #2b171c; }
.button.large { min-height: 47px; padding-inline: 20px; }
.button.compact { min-height: 32px; padding: 5px 10px; font-size: 12px; }

.dashboard-toolbar { display: flex; justify-content: space-between; align-items: end; margin-bottom: 16px; }
.search-box { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
input, select, textarea { width: 100%; color: var(--text); background: #0b1219; border: 1px solid var(--line); border-radius: 9px; padding: 10px 11px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: #44bfa0; box-shadow: 0 0 0 3px rgba(68, 191, 160, .12); }
.search-box input { min-width: 280px; }
.project-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 16px; }
.project-card { border: 1px solid var(--line); border-radius: var(--radius); background: linear-gradient(155deg, rgba(24, 37, 49, .94), rgba(13, 21, 29, .95)); padding: 18px; cursor: pointer; box-shadow: 0 10px 35px rgba(0, 0, 0, .12); transition: transform .18s, border-color .18s; }
.project-card:hover { transform: translateY(-2px); border-color: #426579; }
.project-card-head, .section-line { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.project-card-actions { display: flex; align-items: center; gap: 9px; }
.icon-button.compact { width: 28px; height: 28px; font-size: 18px; border-radius: 8px; }
.icon-button.danger { color: #ffadb2; border-color: #63353c; background: #28161a; }
.project-card h2 { margin: 20px 0 7px; }
.project-card p { color: var(--muted); min-height: 40px; font-size: 13px; }
.badge { display: inline-flex; align-items: center; width: max-content; color: #abe9d8; background: #15362f; border: 1px solid #2b6658; border-radius: 999px; padding: 5px 9px; font-size: 11px; font-weight: 700; }
.project-progress { margin-top: 17px; }
.project-progress-line { height: 5px; background: #0a1117; border-radius: 10px; overflow: hidden; }
.project-progress-line span, .main-progress span, .job-progress span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .25s; }
.project-stats { margin-top: 10px; color: var(--muted); font-size: 12px; display: flex; justify-content: space-between; }
.empty-state { min-height: 420px; display: grid; place-content: center; justify-items: center; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
.empty-symbol { width: 70px; height: 70px; display: grid; place-items: center; border-radius: 22px; background: #13252b; color: var(--accent); font-size: 22px; font-weight: 900; margin-bottom: 18px; }
.empty-state p { color: var(--muted); max-width: 480px; }

.workspace-view { max-width: 1900px; padding-top: 22px; }
.workspace-head { display: flex; align-items: center; gap: 18px; }
.workspace-title { flex: 1; }
.workspace-title h1 { font-size: 29px; margin: 6px 0 4px; }
.workspace-title p { margin: 0; color: var(--muted); font-size: 13px; }
.workspace-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.tabs { display: flex; gap: 5px; margin: 22px 0 14px; overflow-x: auto; border-bottom: 1px solid var(--line); }
.tab { padding: 11px 16px; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer; }
.tab.active { color: var(--text); border-color: var(--accent); }
.job-banner { display: grid; grid-template-columns: minmax(240px, 1fr) minmax(200px, 2fr) auto; align-items: center; gap: 15px; border: 1px solid #3d665b; background: #112a26; padding: 12px 14px; border-radius: 12px; margin-top: 18px; }
.job-banner small { display: block; color: var(--muted); margin-top: 3px; }
.job-details { grid-column: 1 / -1; border-top: 1px solid #315149; padding-top: 9px; }
.job-details summary { cursor: pointer; color: #b9ded5; font-size: 13px; }
.job-result-summary { display: flex; flex-wrap: wrap; gap: 7px; margin: 10px 0 7px; }
.job-result-summary span { border: 1px solid var(--line); border-radius: 99px; padding: 4px 9px; font-size: 12px; color: var(--muted); }
.job-result-log { max-height: 260px; overflow: auto; white-space: pre-wrap; word-break: break-word; background: #07110f; border: 1px solid var(--line); border-radius: 8px; padding: 10px; color: #b7c8c4; font-size: 12px; line-height: 1.45; }
.job-progress, .main-progress { height: 7px; border-radius: 99px; background: #07110f; overflow: hidden; }

.progress-strip { display: grid; grid-template-columns: auto minmax(240px, 1fr) auto; align-items: center; gap: 18px; padding: 13px 16px; border: 1px solid var(--line); border-radius: 12px; background: rgba(16, 24, 33, .8); margin-bottom: 13px; }
.progress-strip strong { margin-left: 8px; }
.class-distribution { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 8px; margin: -2px 0 13px; }
.workflow-panel { display: grid; grid-template-columns: minmax(280px, 1fr) minmax(420px, 1.3fr) auto; align-items: center; gap: 18px; margin: 0 0 13px; padding: 16px 18px; border: 1px solid #30685a; border-radius: 14px; background: linear-gradient(135deg, #112a26, #101c26); }
.workflow-panel h2 { margin: 5px 0 6px; font-size: 18px; }
.workflow-panel p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.5; }
.workflow-steps { display: grid; grid-template-columns: repeat(4, minmax(100px, 1fr)); gap: 7px; }
.workflow-steps span { display: flex; align-items: center; gap: 7px; padding: 8px; border: 1px solid var(--line); border-radius: 9px; color: #c8d7dc; background: #0b151c; font-size: 11px; }
.workflow-steps b { width: 22px; height: 22px; flex: 0 0 22px; display: grid; place-items: center; border-radius: 50%; color: #071510; background: var(--accent); }
@media (max-width: 1180px) { .workflow-panel { grid-template-columns: 1fr; } .workflow-steps { grid-template-columns: repeat(2, 1fr); } }
.distribution-card { --distribution-color: var(--accent); padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--distribution-color); border-radius: 10px; background: #0d161e; min-width: 0; }
.distribution-card-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.distribution-card strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12px; }
.distribution-card span { color: var(--distribution-color); font-weight: 800; }
.distribution-card small { display: block; color: var(--muted); margin-top: 3px; }
.distribution-bar { height: 4px; margin-top: 8px; border-radius: 99px; background: #07110f; overflow: hidden; }
.distribution-bar i { display: block; height: 100%; width: var(--distribution-width); background: var(--distribution-color); border-radius: inherit; }
.annotation-workspace { display: grid; grid-template-columns: minmax(0, 1fr) minmax(300px, 380px); gap: 14px; min-height: calc(100vh - 260px); }
.annotation-fullscreen-dialog { width: calc(100vw - 18px); max-width: none; height: calc(100vh - 18px); max-height: none; margin: auto; padding: 9px; overflow: hidden; color: var(--text); background: #080d13; border: 1px solid #354654; border-radius: 14px; box-shadow: 0 30px 100px rgba(0, 0, 0, .78); }
.annotation-fullscreen-dialog::backdrop { background: rgba(0, 3, 6, .88); backdrop-filter: blur(5px); }
.fullscreen-annotation-head { height: 48px; display: flex; align-items: center; justify-content: space-between; gap: 18px; padding: 0 5px 8px 10px; }
.fullscreen-annotation-head > div { min-width: 0; display: flex; align-items: baseline; gap: 13px; }
.fullscreen-annotation-head strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fullscreen-annotation-head small { color: var(--muted); white-space: nowrap; }
.fullscreen-annotation-workspace { height: calc(100% - 48px); display: grid; grid-template-columns: minmax(0, 1fr) 286px; gap: 9px; }
.fullscreen-annotation-workspace .image-card { height: 100%; padding: 8px; grid-template-rows: auto minmax(0, 1fr) auto; }
.fullscreen-annotation-workspace .viewer-shell { min-height: 0; }
.fullscreen-annotation-workspace .image-toolbar { min-height: 45px; padding-bottom: 7px; gap: 10px; }
.fullscreen-annotation-workspace #zoomHint { display: none; }
.fullscreen-annotation-workspace .navigation-row { padding-top: 7px; }
.fullscreen-annotation-workspace .classes-card { height: 100%; padding: 12px; gap: 8px; overflow: hidden; }
.fullscreen-annotation-workspace .classes-card h2 { font-size: 16px; margin: 2px 0; }
.fullscreen-annotation-workspace .classes-card .eyebrow,
.fullscreen-annotation-workspace #classesHint { display: none; }
.fullscreen-annotation-workspace .class-buttons { max-height: 42vh; gap: 5px; }
.fullscreen-annotation-workspace .class-button { min-height: 44px; grid-template-columns: 36px 1fr auto; padding: 6px; }
.fullscreen-annotation-workspace .hotkey { width: 29px; height: 29px; }
.fullscreen-annotation-workspace .drawing-help { padding: 7px; font-size: 11px; }
.fullscreen-annotation-workspace .annotation-list { max-height: min(30vh, 270px); }
.image-card, .classes-card, .panel-card, .ready-panel { border: 1px solid var(--line); border-radius: var(--radius); background: rgba(16, 24, 33, .94); box-shadow: var(--shadow); }
.image-card { padding: 12px; display: grid; grid-template-rows: auto minmax(420px, 1fr) auto; min-width: 0; }
.image-toolbar { min-height: 54px; display: flex; align-items: center; gap: 20px; padding: 0 5px 10px; }
.image-toolbar > div:first-child { flex: 1; }
.image-toolbar small { display: block; color: var(--muted); margin-top: 5px; }
.image-toolbar label { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12px; }
.image-toolbar select { min-width: 180px; }
.item-status { display: inline-flex; padding: 5px 9px; border-radius: 8px; color: #ffd1aa; background: #38291e; border: 1px solid #6f4d33; font-size: 12px; font-weight: 700; }
.item-status.complete { color: #aff2dd; background: #19362f; border-color: #326a5c; }
.viewer-shell { position: relative; min-height: 420px; overflow: hidden; border-radius: 11px; background-color: #05080b; background-image: linear-gradient(45deg, #0b1015 25%, transparent 25%), linear-gradient(-45deg, #0b1015 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #0b1015 75%), linear-gradient(-45deg, transparent 75%, #0b1015 75%); background-size: 24px 24px; background-position: 0 0, 0 12px, 12px -12px, -12px 0; }
#classificationImage { width: 100%; height: 100%; object-fit: contain; position: absolute; inset: 0; user-select: none; }
#annotationCanvas { width: 100%; height: 100%; position: absolute; inset: 0; cursor: crosshair; outline: none; touch-action: none; }
.viewer-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.navigation-row { display: flex; align-items: center; gap: 8px; padding-top: 11px; flex-wrap: wrap; }
.navigation-row label { display: flex; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.navigation-row input { width: 80px; }
.classes-card { padding: 17px; display: flex; flex-direction: column; gap: 13px; min-height: 0; }
.classes-card h2 { margin: 5px 0; }
.classes-card p { color: var(--muted); font-size: 13px; margin: 0; }
.class-buttons { overflow-y: auto; display: grid; gap: 8px; padding-right: 3px; max-height: 48vh; }
.class-button { width: 100%; min-height: 54px; display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 9px; text-align: left; background: #111b24; border: 1px solid var(--class-color, var(--line)); border-radius: 11px; color: var(--text); padding: 9px; cursor: pointer; }
.class-button.active { box-shadow: 0 0 0 2px var(--class-color); background: color-mix(in srgb, var(--class-color) 14%, #111b24); }
.hotkey { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 8px; background: #080d12; color: var(--class-color); font-weight: 900; }
.class-button small { display: block; color: var(--muted); margin-top: 3px; }
.class-count { color: var(--muted); font-size: 11px; }
.drawing-help { color: #b8dce9; background: #132833; border: 1px solid #285266; border-radius: 10px; padding: 10px; font-size: 12px; line-height: 1.45; }
.annotations-block { border-top: 1px solid var(--line); padding-top: 13px; min-height: 0; }
.annotation-list { display: grid; gap: 6px; margin: 10px 0; max-height: 210px; overflow-y: auto; }
.annotation-row { display: grid; grid-template-columns: 13px 1fr auto; align-items: center; gap: 8px; padding: 8px; background: #0c141b; border-radius: 8px; font-size: 12px; }
.annotation-row { cursor: pointer; }
.annotation-row:hover { background: #14232e; }
.annotation-row small { display: block; color: var(--muted); margin-top: 3px; }
.annotation-row select { display: block; width: 100%; margin-top: 5px; padding: 5px 7px; font-size: 11px; }
.color-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--dot); }
.delete-annotation { border: 0; background: transparent; color: #e28c91; cursor: pointer; }

.ready-panel { padding: 18px; margin-bottom: 14px; }
.ready-hero { max-width: 1000px; margin-bottom: 16px; }
.ready-hero h2 { font-size: 22px; margin: 8px 0; }
.ready-hero p { color: var(--muted); line-height: 1.55; }
.dataset-list { display: grid; gap: 9px; }
.ready-panel .dataset-list { max-height: 180px; overflow-y: auto; }
.dataset-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 16px; padding: 13px 15px; border: 1px solid var(--line); border-radius: 11px; background: #0c141b; }
.dataset-row > div { min-width: 0; overflow-wrap: anywhere; }
.dataset-row small { display: block; color: var(--muted); margin-top: 4px; }
.dataset-error { grid-column: 1 / -1; margin: 0; padding: 10px 12px; border-radius: 8px; color: #ffb4b8; background: #351a20; white-space: pre-wrap; overflow-wrap: anywhere; }
.state-pill { padding: 5px 8px; border-radius: 999px; font-size: 11px; background: #242d35; }
.state-pill.ready { color: #aff2dd; background: #17372f; }
.state-pill.failed { color: #ffb4b8; background: #351a20; }

.training-layout { display: grid; grid-template-columns: minmax(380px, 560px) minmax(450px, 1fr); gap: 14px; align-items: start; }
.settings-column, .runs-column { display: grid; gap: 12px; }
.panel-card { padding: 18px; }
.field { display: grid; gap: 6px; color: var(--muted); font-size: 12px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.backend-options { align-items: center; gap: 13px; }
.check-row { display: flex; align-items: flex-start; gap: 9px; color: #cad5db; font-size: 13px; }
.check-row input { width: auto; margin-top: 2px; }
.license-notice { color: #ffd4a1; background: #302518; border: 1px solid #644a2b; padding: 10px; border-radius: 9px; font-size: 12px; margin-top: 12px; }
.active-run-card h2 { margin: 12px 0; }
.training-log { white-space: pre-wrap; overflow-y: auto; min-height: 170px; max-height: 280px; padding: 13px; border-radius: 10px; color: #b7c6ce; background: #080d12; border: 1px solid #1e2b36; font: 12px/1.55 ui-monospace, SFMono-Regular, Consolas, monospace; }
.metrics-panel { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.training-history { overflow: auto; max-height: 320px; margin-top: 12px; }
.training-history table { width: 100%; border-collapse: collapse; font-size: 13px; }
.training-history th, .training-history td { padding: 8px; text-align: right; border-bottom: 1px solid var(--line); white-space: nowrap; }
.training-history th { color: var(--muted); }
.training-history tr.best-epoch { background: #102822; color: #b9f3e2; }
.metrics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(135px, 1fr)); gap: 8px; margin-top: 11px; }
.metric-card { padding: 11px; border-radius: 10px; border: 1px solid #2b4f58; background: #0d2027; }
.metric-card small { display: block; color: var(--muted); min-height: 28px; line-height: 1.3; }
.metric-card strong { display: block; color: #b9f3e2; font-size: 19px; margin-top: 5px; }
.metrics-details { margin-top: 10px; color: var(--muted); font-size: 12px; }
.metrics-details summary { cursor: pointer; }
.metrics-details pre { max-height: 320px; overflow: auto; padding: 10px; color: #b7c6ce; background: #080d12; border-radius: 8px; white-space: pre-wrap; }
.weights-panel { border-top: 1px solid var(--line); padding-top: 13px; }
.weight-link { display: flex; justify-content: space-between; gap: 15px; margin-top: 8px; padding: 10px; border: 1px solid #2b5f53; border-radius: 9px; background: #102822; color: #b9f3e2; overflow: hidden; }
.weight-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.training-runs { display: grid; gap: 7px; margin-top: 12px; max-height: 420px; overflow-y: auto; }
.run-row { padding: 11px; border: 1px solid var(--line); border-radius: 9px; background: #0c141b; cursor: pointer; }
.run-row:hover { border-color: var(--line-strong); }
.run-row.selected { border-color: #3b806e; background: #10231f; }
.run-row small { display: block; color: var(--muted); margin-top: 4px; }
.crop-export-card { display: flex; align-items: center; justify-content: space-between; gap: 16px; border-color: #2f6658; background: linear-gradient(135deg, #10251f, #101a22); }
.crop-export-card strong, .crop-export-card small { display: block; }
.crop-export-card strong { margin-top: 5px; }
.crop-export-card small { margin-top: 5px; color: var(--muted); line-height: 1.4; }
.inference-head-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }

.inference-layout { display: grid; grid-template-columns: minmax(360px, 480px) minmax(520px, 1fr); gap: 14px; align-items: start; }
.inference-setup-card, .inference-input-card { display: grid; gap: 14px; }
.inference-setup-card h2, .inference-active-card h2 { margin: 5px 0 0; }
.drop-field { position: relative; min-height: 82px; display: grid; align-items: center; padding: 14px; border: 1px dashed #416071; border-radius: 12px; background: #0a131a; cursor: pointer; }
.drop-field:hover { border-color: #4bbfa2; background: #0d1b20; }
.drop-field input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; }
.drop-field span { pointer-events: none; }
.drop-field strong, .drop-field small { display: block; }
.drop-field small { margin-top: 6px; color: var(--muted); line-height: 1.4; }
.image-drop-field { min-height: 104px; border-color: #2f7464; background: linear-gradient(135deg, #0d211d, #0a151c); }
.inference-results-column { display: grid; gap: 12px; min-width: 0; }
.inference-active-card { min-height: 520px; }
.inference-active-card > .main-progress { margin-top: 15px; }
.inference-summary { margin: 11px 0 15px; font-size: 13px; }
.inference-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 11px; }
.inference-empty { grid-column: 1 / -1; min-height: 330px; display: grid; place-content: center; justify-items: center; gap: 7px; color: var(--muted); border: 1px dashed var(--line); border-radius: 12px; text-align: center; }
.inference-empty span { color: var(--accent); font-size: 32px; }
.inference-empty strong { color: var(--text); }
.inference-card { overflow: hidden; border: 1px solid var(--line); border-radius: 12px; background: #0a1219; cursor: pointer; transition: border-color .16s, transform .16s; }
.inference-card:hover { border-color: #397a69; transform: translateY(-1px); }
.inference-card img { width: 100%; aspect-ratio: 4 / 3; display: block; object-fit: contain; background: #05080b; }
.inference-card-body { display: grid; gap: 7px; padding: 11px; }
.inference-card-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.inference-card-title strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.inference-card-title span { color: #aef0dd; font-weight: 800; font-size: 12px; white-space: nowrap; }
.prediction-list { display: flex; flex-wrap: wrap; gap: 5px; }
.prediction-chip { padding: 4px 7px; border-radius: 999px; color: #b9c8cf; background: #15232d; font-size: 11px; }
.inference-result-dialog { width: min(1280px, calc(100vw - 30px)); }
.inference-result-detail { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr); gap: 18px; align-items: start; }
.inference-result-detail > img { width: 100%; max-height: calc(100vh - 170px); object-fit: contain; border-radius: 12px; background: #05080b; border: 1px solid var(--line); }
.inference-result-facts { display: grid; gap: 8px; }
.inference-fact { display: flex; justify-content: space-between; gap: 12px; padding: 10px; border: 1px solid var(--line); border-radius: 9px; background: #0b141b; color: var(--muted); font-size: 12px; }
.inference-fact strong { color: var(--text); text-align: right; }

.management-grid { display: grid; grid-template-columns: repeat(2, minmax(340px, 1fr)); gap: 14px; align-items: start; }
.management-grid .panel-card { display: grid; gap: 13px; }
.settings-classes, .management-list { display: grid; gap: 8px; }
.settings-class-row { display: grid; grid-template-columns: 14px minmax(110px, .7fr) minmax(150px, 1fr) 90px 58px; gap: 8px; align-items: center; }
.settings-class-row input[type="color"] { height: 40px; padding: 3px; }
.inline-editor { display: grid; grid-template-columns: minmax(150px, 1fr) minmax(120px, .6fr) auto; gap: 8px; align-items: end; }
.management-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: #0c141b; }
.management-row small { display: block; color: var(--muted); margin-top: 3px; }
.management-row-actions { display: flex; align-items: center; gap: 7px; }
.task-editor { display: grid; grid-template-columns: repeat(2, minmax(130px, 1fr)); gap: 10px; align-items: end; }
.task-editor .button { grid-column: 1 / -1; }
.user-create-form { display: grid; grid-template-columns: repeat(4, minmax(140px, 1fr)) auto; gap: 10px; align-items: end; padding-bottom: 18px; margin-bottom: 18px; border-bottom: 1px solid var(--line); }
#adminUserList .management-row { grid-template-columns: minmax(170px, 1fr) 150px auto auto auto; }
.statistics-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px; }
.stat-card { display: grid; gap: 7px; padding: 13px; border: 1px solid var(--line); border-radius: 11px; background: #0c141b; }
.stat-card > small { color: var(--muted); }
.stat-card > div { display: flex; justify-content: space-between; gap: 12px; color: var(--muted); font-size: 12px; }
.stat-card b { color: var(--text); text-align: right; }
.task-progress { height: 5px; margin-top: 8px; overflow: hidden; border-radius: 99px; background: #060b0f; }
.task-progress span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.statistics-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.statistics-table th, .statistics-table td { padding: 10px; border-bottom: 1px solid var(--line); text-align: left; }
.statistics-table th { color: var(--muted); font-weight: 600; }

.dialog { width: min(980px, calc(100vw - 30px)); max-height: calc(100vh - 30px); overflow: auto; color: var(--text); background: #101820; border: 1px solid #354654; border-radius: 18px; box-shadow: 0 30px 90px rgba(0,0,0,.6); padding: 22px; }
.dialog::backdrop { background: rgba(1, 5, 8, .75); backdrop-filter: blur(7px); }
.dialog-head { display: flex; justify-content: space-between; align-items: start; gap: 20px; margin-bottom: 20px; }
.dialog-head h2 { font-size: 27px; margin: 6px 0 0; }
#addProjectClassDialog { width: min(520px, calc(100vw - 30px)); }
#addProjectClassForm { display: grid; gap: 14px; }
#addProjectClassForm .dialog-head { margin-bottom: 0; }
#newClassColor { width: 100%; height: 40px; padding: 4px; }
.icon-button { width: 38px; height: 38px; border: 1px solid var(--line); border-radius: 10px; background: #111b24; color: var(--text); cursor: pointer; font-size: 23px; }
.wizard-grid { display: grid; grid-template-columns: 1fr 250px; gap: 18px; }
.wizard-main { display: grid; gap: 14px; }
.wizard-aside { background: #0b1218; border: 1px solid var(--line); border-radius: 13px; padding: 16px; color: var(--muted); font-size: 13px; }
.wizard-aside strong { color: var(--text); }
.wizard-aside ol { padding-left: 20px; line-height: 2; }
.two-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.provider-list { display: grid; gap: 8px; margin-bottom: 16px; }
.provider-row { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 10px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: #0c141b; }
.provider-row small { display: block; color: var(--muted); margin-top: 3px; }
.provider-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; border-top: 1px solid var(--line); padding-top: 16px; }
.auto-label-classes { display: grid; gap: 9px; margin: 15px 0; }
.auto-class-row { display: grid; grid-template-columns: minmax(160px, .35fr) 1fr; gap: 10px; align-items: center; }
.auto-class-row textarea { min-height: 66px; resize: vertical; }
.source-choice { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.source-choice label { display: flex; align-items: flex-start; gap: 9px; border: 1px solid var(--line); padding: 12px; border-radius: 11px; cursor: pointer; }
.source-choice input { width: auto; margin-top: 3px; }
.source-choice small { display: block; color: var(--muted); margin-top: 4px; }
.classes-editor-head { display: flex; justify-content: space-between; align-items: end; margin: 23px 0 8px; }
.classes-editor-head h3 { margin: 4px 0 0; }
.class-table-wrap { max-height: 310px; overflow: auto; border: 1px solid var(--line); border-radius: 11px; }
.class-table { width: 100%; border-collapse: collapse; }
.class-table th { position: sticky; top: 0; background: #131d26; color: var(--muted); text-align: left; font-size: 11px; padding: 9px; z-index: 1; }
.class-table td { padding: 7px; border-top: 1px solid #202e3a; }
.class-table input[type="color"] { padding: 2px; min-width: 50px; height: 38px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 20px; }
.help-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 13px; }
.help-grid section { border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.help-grid pre { background: #080d12; padding: 12px; border-radius: 8px; overflow-x: auto; color: #b8d9d0; }
.help-dialog > p { color: var(--muted); }
code { color: #b7f0df; background: #0a1515; padding: 2px 5px; border-radius: 5px; }

.toast-region { position: fixed; top: 82px; right: 18px; display: grid; gap: 8px; z-index: 100; width: min(390px, calc(100vw - 36px)); }
.toast { padding: 12px 14px; border: 1px solid #406055; border-radius: 11px; background: #13231f; box-shadow: var(--shadow); font-size: 13px; animation: toast-in .2s ease-out; }
.toast.error { border-color: #754047; background: #2a181c; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } }

@media (max-width: 1050px) {
  .annotation-workspace, .training-layout, .inference-layout { grid-template-columns: 1fr; }
  .classes-card { min-height: 500px; }
  .class-buttons { max-height: 360px; }
  .workspace-head { align-items: flex-start; flex-wrap: wrap; }
  .workspace-title { min-width: 60%; }
  .workspace-actions { width: 100%; justify-content: flex-start; }
  .wizard-grid { grid-template-columns: 1fr; }
  .wizard-aside { display: none; }
  .management-grid { grid-template-columns: 1fr; }
  .user-create-form { grid-template-columns: repeat(2, minmax(160px, 1fr)); }
  #adminUserList .management-row { grid-template-columns: 1fr auto; }
}

@media (max-width: 850px) {
  .fullscreen-annotation-workspace { grid-template-columns: minmax(0, 1fr) 220px; }
  .fullscreen-annotation-workspace .image-toolbar label,
  .fullscreen-annotation-workspace #nextIncompleteButton,
  .fullscreen-annotation-workspace #deleteItemButton,
  .fullscreen-annotation-workspace .navigation-row label,
  .fullscreen-annotation-workspace #jumpButton { display: none; }
  .fullscreen-annotation-head small { display: none; }
}

@media (max-width: 680px) {
  .app-header { padding-inline: 14px; }
  .header-status { display: none; }
  .view { padding: 22px 13px 35px; }
  .hero-row { align-items: stretch; flex-direction: column; }
  .dashboard-toolbar { align-items: stretch; gap: 8px; }
  .search-box, .search-box input { width: 100%; min-width: 0; }
  .progress-strip { grid-template-columns: 1fr; }
  .image-toolbar { align-items: flex-start; flex-wrap: wrap; }
  .zoomHint { display: none; }
  .navigation-row .spacer { display: none; }
  .field-grid, .two-columns, .source-choice, .help-grid { grid-template-columns: 1fr; }
  .dialog { padding: 16px; }
  .class-table { min-width: 650px; }
  .job-banner { grid-template-columns: 1fr; }
  .user-chip { display: none; }
  .inline-editor, .settings-class-row, .task-editor, .user-create-form { grid-template-columns: 1fr; }
  .inference-result-detail { grid-template-columns: 1fr; }
  .crop-export-card { align-items: stretch; flex-direction: column; }
}

#trainingActivity { margin-bottom: 14px; padding: 12px 16px; border: 1px solid #77582d; border-radius: 10px; background: #2b2115; color: #ffd699; }
