:root {
  color-scheme: light;
  --ink: #16221d;
  --muted: #66736d;
  --line: #dce5df;
  --surface: #ffffff;
  --soft: #f3f7f4;
  --canvas: #111714;
  --green: #0f6b4f;
  --green-dark: #0a4f3b;
  --mint: #dff3e9;
  --blue: #1689c7;
  --amber: #e39a2d;
  --magenta: #b85dd7;
  --danger: #a43c3c;
  --shadow: 0 18px 50px rgba(25, 47, 37, 0.12);
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; background: #f6f8f6; color: var(--ink); font: 15px/1.45 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.visually-hidden { position: fixed; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow { margin: 0 0 7px; color: var(--green); font-size: 12px; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(32px, 4vw, 54px); line-height: 1.02; letter-spacing: -.04em; }
h2 { margin-bottom: 5px; font-size: 20px; letter-spacing: -.02em; }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at 15% 12%, #d8eee3 0, transparent 33%), radial-gradient(circle at 85% 80%, #dcebf0 0, transparent 35%), #eef3ef; }
.login-card { width: min(100%, 470px); padding: 46px; border: 1px solid rgba(15, 107, 79, .13); border-radius: 28px; background: rgba(255, 255, 255, .94); box-shadow: var(--shadow); }
.brand-mark { width: 54px; height: 54px; display: grid; place-items: center; margin-bottom: 28px; border-radius: 15px 15px 15px 4px; background: var(--green); color: white; font-size: 25px; font-weight: 850; }
.brand-mark.small { width: 38px; height: 38px; margin: 0; border-radius: 11px 11px 11px 3px; font-size: 18px; }
.lede { color: var(--muted); font-size: 17px; }
.stack { display: grid; gap: 9px; margin-top: 30px; }
label { color: #3d4943; font-size: 13px; font-weight: 750; }
input, select { width: 100%; border: 1px solid #cad6cf; border-radius: 11px; background: white; color: var(--ink); padding: 11px 12px; outline: none; }
input:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(15, 107, 79, .12); }
.form-error { min-height: 20px; margin: 0; color: var(--danger); font-size: 13px; }
.security-note { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.security-note span { color: #35a776; margin-right: 5px; }

.button { min-height: 40px; padding: 9px 14px; border: 1px solid transparent; border-radius: 10px; background: white; color: var(--ink); font-weight: 760; transition: transform .15s ease, background .15s ease, border-color .15s ease; }
.button:hover { transform: translateY(-1px); }
.button:disabled { cursor: not-allowed; opacity: .5; transform: none; }
.button.primary { background: var(--green); color: white; }
.button.primary:hover { background: var(--green-dark); }
.button.secondary { border-color: var(--line); background: white; }
.button.dark { background: var(--ink); color: white; }
.button.ghost { border-color: transparent; background: transparent; color: #53615a; }
.button.danger { border-color: #eed3d3; background: #fff6f5; color: var(--danger); }
.button.small { min-height: 34px; padding: 6px 10px; font-size: 13px; }
.button.wide { width: 100%; }

.app-shell { min-height: 100vh; }
.topbar { position: sticky; top: 0; z-index: 30; height: 66px; display: flex; align-items: center; padding: 0 28px; border-bottom: 1px solid var(--line); background: rgba(255, 255, 255, .94); backdrop-filter: blur(16px); }
.brand-button { display: flex; align-items: center; gap: 11px; padding: 0; border: 0; background: transparent; color: var(--ink); text-align: left; }
.brand-button strong, .brand-button small { display: block; line-height: 1.05; }
.brand-button strong { font-size: 16px; }.brand-button small { margin-top: 3px; color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.topbar-spacer { flex: 1; }
.save-state { margin-right: 12px; color: var(--green); font-size: 13px; font-weight: 750; }
.page { width: min(1320px, calc(100% - 48px)); margin: 0 auto; padding: 44px 0 80px; }
.hero-panel, .dataset-header { display: flex; align-items: flex-end; justify-content: space-between; gap: 40px; }
.hero-panel { padding: 34px 38px; border-radius: 24px; background: linear-gradient(130deg, #e0f1e8, #f4f8f5 55%, #e9f1f3); }
.hero-panel > div { max-width: 640px; }.hero-panel p:last-child { max-width: 620px; margin-bottom: 0; color: var(--muted); }
.create-dataset { width: min(440px, 100%); padding: 18px; border: 1px solid rgba(15, 107, 79, .12); border-radius: 16px; background: rgba(255,255,255,.8); }
.create-dataset label { display: block; margin-bottom: 7px; }
.input-action { display: flex; gap: 8px; }.input-action input { min-width: 0; }
.section-heading { display: flex; justify-content: space-between; align-items: end; margin: 38px 0 16px; }
.section-heading p, .dataset-header p, #datasetMeta { margin-bottom: 0; color: var(--muted); }
.dataset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(285px, 1fr)); gap: 16px; }
.dataset-card { position: relative; min-height: 220px; overflow: hidden; border: 1px solid var(--line); border-radius: 18px; background: var(--surface); box-shadow: 0 5px 18px rgba(33, 55, 44, .05); text-align: left; }
.dataset-card:hover { border-color: #a8c5b5; transform: translateY(-2px); }
.dataset-card-open { width: 100%; min-height: 218px; padding: 22px; border: 0; background: transparent; color: inherit; text-align: left; }
.dataset-card-delete, .image-card-delete { position: absolute; z-index: 2; padding: 6px 8px; border: 1px solid #eed3d3; border-radius: 8px; background: rgba(255, 246, 245, .96); color: var(--danger); font-size: 11px; font-weight: 780; opacity: 0; transition: opacity .15s ease; }
.dataset-card-delete { top: 14px; right: 14px; }
.dataset-card:hover .dataset-card-delete, .dataset-card:focus-within .dataset-card-delete, .image-card:hover .image-card-delete, .image-card:focus-within .image-card-delete { opacity: 1; }
.folder-tab { width: 54px; height: 12px; margin: -22px 0 24px; border-radius: 0 0 8px 8px; background: var(--mint); }
.dataset-card h3 { margin: 0 0 5px; font-size: 19px; }.dataset-card .subtle { color: var(--muted); font-size: 13px; }
.card-progress { height: 7px; margin: 28px 0 12px; overflow: hidden; border-radius: 20px; background: #ecf0ed; }.card-progress span { display: block; height: 100%; border-radius: inherit; background: var(--green); }
.card-footer { display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; }.card-footer strong { color: var(--ink); }
.empty-state { display: grid; justify-items: center; padding: 70px 20px; border: 1px dashed #bfd0c6; border-radius: 20px; color: var(--muted); text-align: center; }
.empty-state.compact { padding: 45px 20px; }.empty-icon { width: 52px; height: 52px; display: grid; place-items: center; margin-bottom: 15px; border-radius: 16px; background: var(--mint); color: var(--green); font-size: 28px; }
.back-button { margin-bottom: 28px; padding: 0; border: 0; background: transparent; color: var(--green); font-weight: 780; }
.dataset-header h1 { margin-bottom: 8px; font-size: 42px; }.header-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.progress-panel { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(240px, 2fr) auto; align-items: center; gap: 22px; margin-top: 30px; padding: 18px 20px; border: 1px solid var(--line); border-radius: 16px; background: white; }
.progress-copy strong, .progress-copy span { display: block; }.progress-copy span { margin-top: 3px; color: var(--muted); font-size: 12px; }
.progress-track { height: 10px; overflow: hidden; border-radius: 20px; background: #e8eeea; }.progress-track span { display: block; width: 0; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #49a97d); transition: width .25s ease; }
.upload-progress { margin-top: 14px; padding: 12px 15px; border-radius: 11px; background: #e8f3ed; color: var(--green-dark); font-weight: 700; }
.image-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 15px; }
.image-card { position: relative; overflow: hidden; padding: 0; border: 1px solid var(--line); border-radius: 15px; background: white; text-align: left; }
.image-card:hover { border-color: #9fbeaD; }.image-card img { width: 100%; aspect-ratio: 4 / 3; display: block; object-fit: cover; background: var(--soft); }
.image-card-open { width: 100%; padding: 0; border: 0; background: white; color: inherit; text-align: left; }
.image-card-delete { top: 9px; right: 9px; }
.image-card-copy { display: block; padding: 13px 14px 15px; }.image-card-copy strong { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.image-card-copy small { display: flex; justify-content: space-between; margin-top: 6px; color: var(--muted); }.status-complete { color: var(--green) !important; }.status-draft { color: var(--amber) !important; }

.label-page { min-height: calc(100vh - 66px); background: #eef2ef; }
.label-toolbar { min-height: 66px; display: flex; align-items: center; gap: 10px; padding: 10px 18px; border-bottom: 1px solid var(--line); background: white; }
.label-title { min-width: 0; margin-right: auto; }.label-title strong, .label-title span { display: block; }.label-title strong { max-width: 360px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }.label-title span { color: var(--muted); font-size: 12px; }
.toolbar-counts { display: flex; gap: 6px; }.toolbar-counts span { padding: 5px 8px; border-radius: 20px; background: var(--soft); color: #4c5a53; font-size: 11px; font-weight: 750; }
.label-workspace { display: grid; grid-template-columns: minmax(0, 1fr) 310px; height: calc(100vh - 66px - 94px); min-height: 610px; }
.canvas-panel { min-width: 0; display: flex; flex-direction: column; padding: 12px; background: var(--canvas); }
.instruction-strip { padding: 7px 10px 12px; color: #aab8b0; font-size: 12px; }.instruction-strip strong { color: #e7eee9; }
.canvas-wrap { min-height: 0; flex: 1; display: grid; place-items: center; overflow: hidden; border-radius: 10px; background: #080b09; }
#labelCanvas { width: 100%; height: 100%; display: block; touch-action: none; cursor: crosshair; }
.inspector { overflow-y: auto; border-left: 1px solid var(--line); background: white; }
.inspector section { padding: 22px; border-bottom: 1px solid var(--line); }.inspector h2 { font-size: 18px; }.help { margin-bottom: 16px; color: var(--muted); font-size: 12px; }
.anchor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }.anchor-button { display: flex; align-items: center; gap: 8px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: white; color: var(--ink); text-align: left; font-size: 12px; font-weight: 750; }.anchor-button.active { border-color: var(--green); background: var(--mint); }.anchor-button kbd { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: var(--soft); font: 700 11px ui-monospace, monospace; }
.step-heading { display: flex; align-items: center; justify-content: space-between; gap: 10px; }.step-heading .eyebrow { margin-bottom: 3px; }
fieldset { display: grid; gap: 7px; margin: 0; padding: 0; border: 0; }fieldset label { margin-top: 8px; }fieldset label span { color: var(--muted); font-weight: 500; }
.inspector-footer p { margin: 14px 0 0; color: var(--muted); font-size: 11px; }.text-button { padding: 0; border: 0; background: transparent; color: var(--danger); font-weight: 750; }
.filmstrip { height: 94px; display: flex; gap: 8px; overflow-x: auto; padding: 10px 14px; border-top: 1px solid var(--line); background: white; }
.filmstrip-button { position: relative; flex: 0 0 96px; overflow: hidden; padding: 0; border: 2px solid transparent; border-radius: 9px; background: var(--soft); }.filmstrip-button.active { border-color: var(--green); }.filmstrip-button img { width: 100%; height: 70px; display: block; object-fit: cover; }.filmstrip-button span { position: absolute; right: 4px; bottom: 4px; width: 9px; height: 9px; border: 2px solid white; border-radius: 50%; background: #b9c4be; }.filmstrip-button.complete span { background: #28a36e; }.filmstrip-button.draft span { background: var(--amber); }
.toast { position: fixed; right: 24px; bottom: 24px; z-index: 60; max-width: 380px; padding: 13px 16px; border-radius: 11px; background: var(--ink); color: white; box-shadow: var(--shadow); font-weight: 700; }

@media (max-width: 980px) {
  .hero-panel, .dataset-header { align-items: stretch; flex-direction: column; }.create-dataset { width: 100%; }.header-actions { justify-content: flex-start; }
  .label-workspace { grid-template-columns: 1fr; height: auto; }.canvas-panel { height: 62vh; min-height: 440px; }.inspector { border-top: 1px solid var(--line); border-left: 0; }.toolbar-counts { display: none; }
}
@media (max-width: 640px) {
  .topbar { padding: 0 14px; }.page { width: min(100% - 28px, 1320px); padding-top: 24px; }.hero-panel { padding: 26px 22px; }.input-action { flex-direction: column; }.progress-panel { grid-template-columns: 1fr; }.label-toolbar { flex-wrap: wrap; }.label-title { order: -1; width: 100%; }.label-toolbar .button { min-height: 36px; padding: 7px 9px; font-size: 12px; }.login-card { padding: 32px 24px; }
}

@media (hover: none) {
  .dataset-card-delete, .image-card-delete { opacity: 1; }
}
