:root {
  --bg: #f5f6f4;
  --surface: #ffffff;
  --text: #1d2420;
  --muted: #5d6862;
  --line: #dde2de;
  --accent: #2f7d4f;
  --accent-ink: #ffffff;
  --accent-soft: #e5f1e9;
  --danger: #b3261e;
  --danger-soft: #fbe9e7;
  --warn: #8a5a00;
  --warn-soft: #fff3d6;
  --radius: 10px;
  --shadow: 0 1px 2px rgb(0 0 0 / 6%);
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
}
a { color: var(--accent); }
h1 { font-size: 1.5rem; margin: 0 0 .75rem; line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 0 0 .75rem; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 0 16px; }
main.wrap { padding-top: 20px; padding-bottom: 48px; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.nowrap { white-space: nowrap; }
.break { overflow-wrap: anywhere; }
.num { text-align: right; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); }
.top-inner { display: flex; align-items: center; gap: 24px; min-height: 56px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand img { display: block; height: 22px; width: auto; }
.brand-sub { color: var(--muted); font-size: .95rem; padding-left: 10px; border-left: 1px solid var(--line); }
.nav { display: flex; gap: 4px; flex-wrap: wrap; }
.nav a, .me a { color: var(--text); text-decoration: none; padding: 6px 10px; border-radius: 6px; }
.nav a:hover, .me a:hover { background: var(--bg); }
.nav a[aria-current], .me a[aria-current] { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.me { margin-left: auto; display: flex; align-items: center; gap: 4px; }
.me form { margin: 0; }

/* controls */
input, select, textarea, button, .button { font: inherit; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=url], input[type=date], select, textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
}
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}
button, .button {
  display: inline-block;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
}
button:hover, .button:hover { border-color: #b9c2bc; }
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
button.primary:hover, .button.primary:hover { filter: brightness(1.08); }
button.link { border: 0; background: none; color: var(--muted); padding: 6px 10px; }
button.link:hover { color: var(--text); }
label { display: block; font-weight: 600; font-size: .9rem; }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 400; }
label.check input { width: auto; margin: 0; }

/* layout pieces */
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.page-head h1 { margin: 0; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.stack > * + * { margin-top: 12px; }
.stack { margin: 0; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.two-col > .card, .two-col > .stack > .card { margin-bottom: 0; }
.two-col > .stack > .card + .card { margin-top: 16px; }
.empty { color: var(--muted); padding: 24px 0; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; background: var(--accent-soft); color: #1d5233; }
.flash.error { background: var(--danger-soft); color: var(--danger); }
.flash.warn { background: var(--warn-soft); color: var(--warn); }

.auth { max-width: 380px; margin: 40px auto; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); }
.auth button.primary { width: 100%; }

.search { display: flex; gap: 8px; }
.search input { width: 420px; max-width: 100%; }
.filters { margin-bottom: 8px; }
.filter-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters input[type=search] { width: 440px; max-width: 100%; }
.filters select { width: auto; max-width: 220px; }
.filters select.wide { max-width: 260px; }
.filters input[type=date] { width: auto; }
.filters .more { margin-top: 8px; }
.filters .more summary { cursor: pointer; color: var(--accent); font-size: .9rem; width: max-content; }
.filters .more .filter-row { margin-top: 8px; padding: 10px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.inline-label { display: flex; align-items: center; gap: 6px; font-weight: 400; }
.inline-label input { margin: 0; }

/* bulk actions */
.bulk-bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px 10px; margin-bottom: 8px; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; }
.bulk-bar select, .bulk-bar input[type=date] { width: auto; max-width: 260px; }
form#bulk.has-selection .bulk-bar { border-color: var(--accent); background: var(--accent-soft); }
.list th.pick, .list td.pick { width: 1%; padding-right: 0; }
.list td.pick input, .list th.pick input { width: 18px; height: 18px; margin: 2px 0 0; }

/* The grey rule is an inset shadow so the active tab's underline can cover it without overflowing. */
.tabs { display: flex; gap: 4px; box-shadow: inset 0 -1px 0 var(--line); margin-bottom: 12px; overflow-x: auto; overflow-y: hidden; }
.tabs a { padding: 8px 12px; text-decoration: none; color: var(--muted); border-bottom: 2px solid transparent; white-space: nowrap; }
.tabs a[aria-current] { color: var(--text); border-bottom-color: var(--accent); font-weight: 600; }
.count { display: inline-block; min-width: 1.6em; padding: 0 6px; border-radius: 99px; background: var(--bg); font-size: .8rem; text-align: center; color: var(--muted); }

/* tables */
.table-wrap { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; box-shadow: var(--shadow); }
table.list { width: 100%; border-collapse: collapse; }
.list th, .list td { padding: 10px 12px; text-align: left; vertical-align: top; border-bottom: 1px solid var(--line); }
.list th { font-size: .8rem; font-weight: 600; color: var(--muted); background: #fafbfa; white-space: nowrap; }
.list tbody tr:last-child td { border-bottom: 0; }
.list tbody tr:hover { background: #fafbfa; }
.list td.title { min-width: 260px; }
.list td.title a { font-weight: 600; text-decoration: none; color: var(--text); }
.list td.title a:hover { color: var(--accent); text-decoration: underline; }
.list .sub { display: block; color: var(--muted); font-size: .85rem; }
.list tr.inactive td { color: var(--muted); }
.overdue { color: var(--danger); font-weight: 600; }
.tag { display: inline-block; font-size: .75rem; font-weight: 600; padding: 1px 6px; border-radius: 4px; background: var(--bg); color: var(--muted); }
.overdue .tag, .tag.overdue { background: var(--danger-soft); color: var(--danger); }
.pager { display: flex; gap: 16px; align-items: center; justify-content: center; margin: 16px 0; }

/* status badges */
.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: .8rem; font-weight: 600; white-space: nowrap; background: #eceeed; color: #49524d; }
.badge.s1 { background: #e3eefc; color: #1f4f8f; }
.badge.s2 { background: var(--warn-soft); color: var(--warn); }
.badge.s3 { background: var(--accent-soft); color: #1d5233; }

/* article page */
.status-card .status-now { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.status-card .status-now .badge { font-size: .95rem; padding: 4px 12px; }
.steps { display: flex; list-style: none; padding: 0; margin: 0 0 14px; gap: 4px; overflow-x: auto; counter-reset: step; }
.steps li { flex: 1 1 0; min-width: 84px; font-size: .75rem; color: var(--muted); padding-top: 10px; border-top: 4px solid var(--line); }
.steps li.done { border-top-color: var(--accent); color: var(--text); }
.steps li.current { border-top-color: var(--accent); color: var(--accent); font-weight: 700; }
form.inline { display: flex; flex-wrap: wrap; align-items: end; gap: 10px; margin: 0; }
form.inline label { display: flex; flex-direction: column; }
form.inline select { width: auto; }
.details { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; }
/* notes & files */
.notes { list-style: none; margin: 0 0 16px; padding: 0; display: grid; gap: 10px; }
.note { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.note.from-team { background: #f6faf7; }
.note.from-author { background: #f4f7fd; }
.note.internal { background: var(--warn-soft); border-style: dashed; }
.note-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.note-head time { color: var(--muted); font-size: .85rem; }
.note-body { margin-top: 6px; white-space: pre-wrap; overflow-wrap: anywhere; }
.note .delete { margin-left: auto; font-size: .85rem; }
.note .delete summary { cursor: pointer; color: var(--muted); }
.note .delete form { margin-top: 6px; }
.files { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 4px; }
.files li::before { content: "📎 "; }
.files a { overflow-wrap: anywhere; }
button.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.note-form { border-top: 1px solid var(--line); padding-top: 14px; }
.note-form input[type=file] { margin-top: 4px; font-weight: 400; }
.radios { border: 0; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 6px 18px; }
.deliver { padding: 8px 10px; background: var(--accent-soft); border-radius: 8px; }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 8px 0 8px 14px; border-left: 2px solid var(--line); position: relative; }
.timeline li::before { content: ""; position: absolute; left: -5px; top: 15px; width: 8px; height: 8px; border-radius: 50%; background: var(--line); }
.timeline li.k-status::before, .timeline li.k-auto::before { background: var(--accent); }
.timeline li.k-delivery::before { background: var(--accent); }
.timeline time { display: block; font-size: .8rem; color: var(--muted); }
.timeline .note { white-space: pre-wrap; }

/* edit form */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; }
.form-grid .span-2 { grid-column: span 2; }
.people label { margin-bottom: 4px; }
.people .filter { margin-bottom: 4px; padding: 6px 8px; font-size: .85rem; }
.actions { display: flex; gap: 10px; }

.copy-row { display: flex; gap: 8px; margin-bottom: 12px; }
.link-card { border-color: var(--accent); }
.stat-list { list-style: none; padding: 0; margin: 0 0 10px; display: flex; flex-wrap: wrap; gap: 8px 14px; }

@media (max-width: 760px) {
  .two-col, .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .me { margin-left: 0; }
  .search { width: 100%; }
  .search input { min-width: 0; flex: 1; }
  .filters input[type=search], .filters select, .filters select.wide { width: 100%; max-width: none; }
  .details { grid-template-columns: 1fr; gap: 0; }
  .details dd { margin-bottom: 8px; }
  .filter-row > * { flex: 1 1 100%; }
  .bulk-bar select, .bulk-bar input[type=date] { max-width: none; flex: 1 1 100%; }
  .brand-sub { display: none; }
}
.list .clip { margin-left: 6px; font-size: .8rem; color: var(--muted); white-space: nowrap; }

/* File picker: the native input (English "Choose Files") sits invisibly inside a Greek button. */
.file-pick { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.file-pick .label { flex-basis: 100%; font-weight: 600; font-size: .9rem; }
.file-pick label.button { position: relative; font-weight: 600; }
.file-pick input[type=file] { position: absolute; inset: 0; opacity: 0; width: 100%; cursor: pointer; }
.file-pick label.button:focus-within { outline: 2px solid var(--accent); outline-offset: 1px; }
.note-form h3 { margin: 0; font-size: 1rem; }

/* footer */
body { display: flex; flex-direction: column; min-height: 100vh; }
main.wrap { flex: 1 0 auto; width: 100%; }
.foot { border-top: 1px solid var(--line); background: var(--surface); color: var(--muted); font-size: .85rem; padding: 14px 0; }

/* training */
.training { line-height: 1.65; }
.training h2 { font-size: 1.25rem; }
.training h3 { font-size: 1.1rem; margin-top: 1.4em; }
.training .video { position: relative; aspect-ratio: 16 / 9; max-width: 760px; margin: 12px auto 4px; background: #111; border-radius: 8px; overflow: hidden; }
.training .video iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.training hr { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }

/* rich text editor */
.rich { display: grid; gap: 4px; }
.rich-label { font-weight: 600; font-size: .9rem; }
.rich-tools { display: flex; flex-wrap: wrap; gap: 4px; }
.rich-tools button { padding: 4px 10px; font-size: .85rem; min-width: 36px; }
.rich-area { border: 1px solid var(--line); border-radius: 8px; background: var(--surface); padding: 10px 12px; line-height: 1.55; overflow-wrap: anywhere; }
.rich-area:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.rich-area p, .rich-out p { margin: 0 0 .6em; }
.rich-area ul, .rich-area ol, .rich-out ul, .rich-out ol { margin: 0 0 .6em; padding-left: 1.4em; }
.note-body.rich-out { white-space: normal; }
.page-head .actions { display: flex; gap: 8px; flex-wrap: wrap; }
.training h4 { font-size: 1rem; margin-top: 1.2em; }
