:root {
  --ink: #162433;
  --muted: #637282;
  --teal: #087E78;
  --teal-dark: #066760;
  --bg: #F3F6F8;
  --soft: #E8EFF1;
  --soft-hover: #D8E4E7;
  --mint: #E8F2EF;
  --line: #DFE7EB;
  --error: #AD3030;
  --done: #087568;
  --draft: #9B640F;
  --font: "Segoe UI", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 13px; }
button, input { font-family: inherit; }

.layout { display: grid; grid-template-columns: 230px 1fr; min-height: 100vh; }

.sidebar { background: var(--ink); color: #fff; display: flex; flex-direction: column; padding: 32px 14px 28px; }
.brand { font-size: 24px; font-weight: 700; line-height: 1.25; padding: 0 10px 28px; }
.sidebar-title { color: #91A9B9; font-size: 11px; font-weight: 700; padding: 0 10px 12px; }
.modes { display: flex; flex-direction: column; gap: 8px; }
.modes button {
  display: flex; gap: 14px; align-items: center; height: 48px; padding: 0 10px; border: 0; border-radius: 8px;
  background: transparent; color: #fff; font-size: 14px; font-weight: 700; text-align: left; cursor: pointer;
}
.modes button span { min-width: 18px; }
.modes button:hover { background: #284354; }
.modes button.active { background: var(--teal); }
.modes button:disabled { cursor: default; opacity: .6; }

.main { padding: 14px 30px; display: flex; flex-direction: column; min-width: 0; }
.crumb { color: var(--muted); font-size: 11px; font-weight: 700; }
h1 { font-size: 30px; margin: 6px 0 12px; }

.toolbar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.count { margin-left: auto; color: var(--muted); font-size: 12px; }

.button {
  height: 38px; padding: 0 16px; border: 0; border-radius: 8px; background: var(--soft); color: var(--ink);
  font-size: 13px; font-weight: 700; cursor: pointer; white-space: nowrap;
}
.button:hover { background: var(--soft-hover); }
.button.primary { background: var(--teal); color: #fff; }
.button.primary:hover { background: var(--teal-dark); }
.button.small { height: 34px; font-size: 12px; min-width: 150px; }
.button.wide { min-width: 185px; }
.button:disabled { opacity: .45; cursor: default; }
.button:disabled:hover { background: var(--soft); }
.button.primary:disabled:hover { background: var(--teal); }

.card { background: #fff; border: 1px solid var(--line); border-radius: 12px; }
.files { flex: 1; min-height: 230px; display: flex; flex-direction: column; padding: 12px; }
.table-wrap { flex: 1; overflow: auto; position: relative; border: 1px solid var(--line); border-radius: 4px; min-height: 160px; }
table { width: 100%; border-collapse: collapse; }
th {
  position: sticky; top: 0; background: #EAF0F3; color: var(--muted); font-size: 10px; font-weight: 700;
  text-align: left; padding: 14px 10px; white-space: nowrap;
}
td { padding: 11px 10px; font-size: 13px; border-bottom: 1px solid #F0F4F6; white-space: nowrap; }
td.name { max-width: 1px; width: 100%; overflow: hidden; text-overflow: ellipsis; }
tbody tr { cursor: default; }
tbody tr.selected { background: #D9F0EB; }
tr.error td { color: var(--error); }
tr.done td { color: var(--done); }
tr.draft td { color: var(--draft); }
.compact td { padding: 6px 10px; }
.empty { position: absolute; inset: 48px 0 0; display: grid; place-items: center; color: var(--muted); }
.detail { color: var(--muted); font-size: 11px; padding: 10px 4px 0; min-height: 24px; overflow-wrap: anywhere; }

body.resize .files { flex: 0 0 200px; min-height: 200px; }
body.resize .table-wrap { min-height: 0; }

.resize-panel { margin-top: 12px; padding: 12px 18px; display: flex; flex-direction: column; }
.resize-name { color: var(--muted); font-size: 12px; margin-bottom: 8px; }
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 10px; }
.presets button {
  height: 48px; border: 0; border-radius: 8px; background: var(--soft); color: var(--ink); font-size: 12px;
  line-height: 1.35; cursor: pointer;
}
.presets button:hover { background: var(--soft-hover); }
.presets button.active { background: var(--teal); color: #fff; }
.dimension-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 22px; margin-bottom: 10px; font-size: 12px; }
.dimension-row input[type=text] {
  width: 85px; height: 34px; margin-left: 8px; padding: 0 8px; border: 1px solid #D6E1E5; border-radius: 6px;
  background: var(--bg); color: var(--ink); font-size: 13px;
}
.check { display: flex; align-items: center; gap: 6px; }
.check input { accent-color: var(--teal); width: 16px; height: 16px; }
.zoom-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 10px; }
.zoom-row .button.small { min-width: 40px; padding: 0 12px; }
.zoom-label { font-size: 12px; font-weight: 700; min-width: 48px; }
.zoom-hint { color: var(--muted); font-size: 11px; }
.previews { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.previews figure { margin: 0; background: var(--bg); border-radius: 8px; padding: 8px 6px; position: relative; text-align: center; }
.previews figcaption { font-size: 12px; font-weight: 700; margin-bottom: 4px; }
.previews canvas { width: 100%; height: 260px; display: block; }
.previews canvas.interactive { cursor: grab; touch-action: none; }
.previews canvas.interactive.dragging { cursor: grabbing; }
.placeholder { position: absolute; inset: 30px 6px 8px; display: grid; place-items: center; color: var(--muted); font-size: 12px; pointer-events: none; }
.resize-footer { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.resize-message { flex: 1; color: var(--muted); font-size: 11px; }
.resize-message.error { color: var(--error); }

.options { margin-top: 14px; }
.panel { background: var(--mint); border-radius: 10px; padding: 12px 16px; margin-bottom: 12px; }
.panel-title { color: var(--teal); font-weight: 700; }
.radio-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.radio-row label { display: flex; align-items: center; gap: 6px; font-size: 12px; }
.radio-row input { accent-color: var(--teal); }
.format-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.format-row .label { margin: 0 6px 0 0; }
.format {
  width: 86px; height: 32px; border: 0; border-radius: 8px; background: #fff; color: var(--ink);
  font-size: 12px; font-weight: 700; cursor: pointer;
}
.format:hover { background: var(--soft-hover); }
.format.active { background: var(--teal); color: #fff; }
.format:disabled { cursor: default; opacity: .6; }
.label { color: var(--muted); font-size: 11px; font-weight: 700; margin-bottom: 6px; }
.destination { display: flex; gap: 8px; margin-bottom: 12px; }
.destination-box {
  flex: 1; min-width: 0; height: 38px; display: flex; align-items: center; padding: 0 10px; background: #fff;
  border: 1px solid #D6E1E5; border-radius: 6px; font-size: 12px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
}
.progress { height: 5px; background: #DCE7E8; border-radius: 3px; overflow: hidden; }
#progress-bar { height: 100%; width: 0; background: var(--teal); transition: width .15s; }

.footer { display: flex; align-items: center; gap: 12px; margin-top: 12px; }
.status { flex: 1; color: var(--muted); font-size: 12px; }

@media (max-width: 760px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { padding: 18px 16px; }
  .modes { display: grid; grid-template-columns: 1fr 1fr; }
  .main { padding: 14px 16px; }
  .radio-row, .presets { grid-template-columns: 1fr; }
  .previews { grid-template-columns: 1fr; }
  .footer { flex-direction: column; align-items: stretch; }
}
