:root {
  --brown: #5a3428;
  --dark: #3d241d;
  --cream: #f7f1ea;
  --gold: #efe2ca;
  --text: #2a211d;
  --muted: #7b6f69;
  --line: #ded5cf;
  --green: #ddebda;
  --red: #f6d6d6;
  --blue: #ddeaf4;
  --shadow: 0 10px 30px rgba(61,36,29,.08);
}
* { box-sizing: border-box; }
body { margin: 0; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: var(--text); background: #fbfaf8; }
a { color: var(--brown); text-decoration: none; }
a:hover { text-decoration: underline; }
.topbar { min-height: 68px; display: flex; align-items: center; gap: 28px; padding: 0 28px; background: var(--dark); color: white; position: sticky; top: 0; z-index: 20; }
.brand { color: white; font-size: 21px; font-weight: 800; letter-spacing: .08em; white-space: nowrap; }
.brand span { font-size: 13px; font-weight: 500; letter-spacing: 0; opacity: .75; margin-left: 5px; }
.nav { display: flex; align-items: center; gap: 18px; flex: 1; }
.nav a, .user-menu a { color: white; opacity: .92; }
.user-menu { display: flex; gap: 14px; align-items: center; font-size: 13px; }
.container { max-width: 1720px; margin: 0 auto; padding: 28px; }
.page-head { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 22px; }
h1 { margin: 0 0 5px; font-size: 30px; }
h2 { margin: 0 0 16px; }
h3 { margin: 0 0 12px; }
.muted { color: var(--muted); margin: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; min-height: 40px; border: 1px solid var(--line); background: white; color: var(--text); padding: 9px 15px; border-radius: 10px; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn:hover { text-decoration: none; box-shadow: 0 4px 12px rgba(0,0,0,.06); }
.btn.primary { background: var(--brown); color: white; border-color: var(--brown); }
.btn.danger { background: #9a302f; color: white; border-color: #9a302f; }
.btn.ghost { background: transparent; }
.btn.wide { width: 100%; }
.flash { padding: 13px 16px; border-radius: 10px; margin-bottom: 18px; border: 1px solid transparent; }
.flash.success { background: #edf7ed; border-color: #b8dcb8; color: #245c24; }
.flash.error { background: #fff0f0; border-color: #e7bbbb; color: #8b2727; }
.filters { display: grid; grid-template-columns: repeat(6, minmax(145px, 1fr)) auto; gap: 12px; align-items: end; padding: 16px; background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); margin-bottom: 20px; }
.filter-actions { display: flex; gap: 8px; }
label { display: grid; gap: 7px; font-weight: 700; font-size: 14px; margin-bottom: 16px; }
input, select, textarea { width: 100%; border: 1px solid #cfc4bd; border-radius: 9px; padding: 10px 11px; background: white; font: inherit; color: var(--text); }
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid rgba(90,52,40,.18); border-color: var(--brown); }
small { color: var(--muted); font-weight: 500; }
.calendar-toolbar { display: flex; justify-content: space-between; align-items: center; margin: 16px 0; }
.calendar-toolbar h2 { margin: 0; }
.calendar { display: grid; grid-template-columns: repeat(7, minmax(150px, 1fr)); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: white; box-shadow: var(--shadow); }
.weekday { background: var(--brown); color: white; font-weight: 800; padding: 11px; text-align: center; }
.day { min-height: 150px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); padding: 8px; background: white; }
.day.empty { background: #f3f0ee; }
.day.today { background: #fffaf0; box-shadow: inset 0 0 0 2px #b69358; }
.day-number { display: flex; justify-content: space-between; font-weight: 800; margin-bottom: 6px; }
.day-number a { width: 22px; height: 22px; border-radius: 50%; background: var(--gold); display: inline-flex; align-items: center; justify-content: center; }
.entry-card { display: block; margin: 5px 0; padding: 7px; border-radius: 8px; background: var(--cream); border-left: 4px solid var(--brown); color: var(--text); }
.entry-card:hover { text-decoration: none; transform: translateY(-1px); }
.entry-card strong, .entry-card span, .entry-card small { display: block; }
.entry-card small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.entry-time { float: right; font-size: 11px; color: var(--muted); }
.panel { background: white; border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 20px; margin-top: 22px; }
.panel-head { display: flex; justify-content: space-between; align-items: center; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid #eee7e2; vertical-align: top; }
th { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.badge, .status-pill { display: inline-block; border-radius: 999px; padding: 4px 8px; background: var(--cream); font-size: 12px; font-weight: 700; }
.empty-state { color: var(--muted); text-align: center; padding: 28px; }
.form-panel fieldset { border: 0; padding: 0; margin: 0; }
.form-grid { display: grid; gap: 15px; }
.form-grid.two { grid-template-columns: repeat(2, minmax(0,1fr)); }
.form-grid.three { grid-template-columns: repeat(3, minmax(0,1fr)); }
.form-grid.four { grid-template-columns: repeat(4, minmax(0,1fr)); }
.form-grid .full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 18px; }
.upload-box { background: var(--cream); border: 1px dashed #b9a79d; padding: 16px; border-radius: 12px; }
.file-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 16px; }
.file-card { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: #fff; }
.file-card img, .file-card video { width: 100%; height: 180px; object-fit: cover; background: #111; }
.file-placeholder { height: 180px; display: flex; align-items: center; justify-content: center; background: var(--cream); font-size: 28px; font-weight: 800; }
.file-meta { display: grid; gap: 5px; padding: 12px; font-size: 13px; }
.file-meta span { color: var(--muted); }
.inline-form { display: inline; }
.inline-form button, .link-button, .link-danger { border: 0; background: none; padding: 0; color: var(--brown); cursor: pointer; font: inherit; }
.link-danger { color: #9a302f !important; }
.split-layout { display: grid; grid-template-columns: minmax(280px, 420px) 1fr; gap: 22px; align-items: start; }
.check { display: flex; grid-template-columns: auto 1fr; align-items: center; }
.check input { width: auto; }
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: linear-gradient(135deg, var(--cream), #fff); }
.auth-card { width: min(440px, 100%); background: white; padding: 30px; border-radius: 18px; box-shadow: 0 20px 55px rgba(61,36,29,.14); border: 1px solid var(--line); }
.auth-card.install-card { width: min(800px, 100%); }
.auth-card h1 { color: var(--brown); letter-spacing: .08em; }
.auth-card h2 { margin-top: 25px; font-size: 18px; }
@media (max-width: 1100px) {
  .filters { grid-template-columns: repeat(3, 1fr); }
  .calendar { overflow-x: auto; grid-template-columns: repeat(7, minmax(180px, 1fr)); }
  .form-grid.four { grid-template-columns: repeat(2,1fr); }
}
@media (max-width: 760px) {
  .topbar { flex-wrap: wrap; padding: 14px 18px; gap: 12px; }
  .nav { order: 3; width: 100%; overflow-x: auto; }
  .user-menu span { display: none; }
  .container { padding: 18px; }
  .page-head { flex-direction: column; }
  .filters, .form-grid.two, .form-grid.three, .form-grid.four, .split-layout { grid-template-columns: 1fr; }
  .calendar-toolbar { gap: 10px; }
  .calendar-toolbar h2 { font-size: 18px; }
}

/* Statusų spalvos */
.status-legend { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 14px; }
.status-pill { border: 1px solid transparent; }
.entry-status { margin-top: 6px; width: fit-content; font-size: 10px; }
.entry-card.status-idea, .status-pill.status-idea { background: #eee7f7; border-color: #cdbce3; color: #5b3f7d; }
.entry-card.status-not-started, .status-pill.status-not-started { background: #f1f1f1; border-color: #d2d2d2; color: #555; }
.entry-card.status-in-progress, .status-pill.status-in-progress { background: #fff1c9; border-color: #e4c56d; color: #765900; }
.entry-card.status-waiting-approval, .status-pill.status-waiting-approval { background: #ffe2bd; border-color: #e2a658; color: #7a4300; }
.entry-card.status-ready, .status-pill.status-ready { background: #ddeaf4; border-color: #9bbdd7; color: #24516b; }
.entry-card.status-scheduled, .status-pill.status-scheduled { background: #e7def8; border-color: #b7a1df; color: #513b7a; }
.entry-card.status-published, .status-pill.status-published { background: #ddebda; border-color: #9fc69b; color: #246b36; }
.entry-card.status-postponed, .status-pill.status-postponed { background: #f6d6d6; border-color: #d99b9b; color: #8a2d2d; }
.entry-card.status-unknown, .status-pill.status-unknown { background: var(--cream); border-color: var(--line); color: var(--text); }
.entry-card[class*="status-"] { border-left-color: currentColor; }

/* CSV importas */
.import-help { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.import-help .panel { margin-top: 0; }
.import-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 18px 0; }
.import-summary > div { background: var(--cream); border: 1px solid var(--line); border-radius: 12px; padding: 15px; }
.import-summary strong { display: block; font-size: 24px; color: var(--brown); }
.code-list { padding-left: 20px; line-height: 1.65; }
@media (max-width: 760px) {
  .import-help, .import-summary { grid-template-columns: 1fr; }
}


/* Atsakingas asmuo kalendoriaus kortelėje */
.entry-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 7px;
  min-width: 0;
}
.entry-meta .entry-status {
  display: inline-flex;
  align-items: center;
  margin-top: 0;
  flex: 0 0 auto;
}
.entry-meta .entry-responsible {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 3px;
  min-width: 0;
  max-width: 58%;
  padding: 2px 5px;
  border: 1px solid rgba(61, 36, 29, .14);
  border-radius: 999px;
  background: rgba(255, 255, 255, .72);
  color: var(--text);
  font-size: 10px;
  font-weight: 700;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Turinio kortelių perkėlimas pele */
.drag-help {
  margin: 0 0 14px;
  padding: 10px 13px;
  border: 1px dashed #c7b3a6;
  border-radius: 10px;
  background: #fffaf4;
  color: var(--brown);
  font-size: 13px;
  font-weight: 700;
}
.entry-card[draggable="true"] {
  cursor: grab;
  user-select: none;
}
.entry-card[draggable="true"]:active { cursor: grabbing; }
.entry-card.dragging {
  opacity: .42;
  transform: rotate(1deg) scale(.98);
}
.entry-card.saving-move {
  opacity: .72;
  pointer-events: none;
}
.day[data-date].drag-over {
  background: #fff4d9;
  box-shadow: inset 0 0 0 3px #b69358;
}
.planner-toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1000;
  max-width: min(380px, calc(100vw - 44px));
  padding: 12px 16px;
  border-radius: 11px;
  background: #246b36;
  color: #fff;
  box-shadow: 0 12px 35px rgba(0,0,0,.2);
  font-weight: 800;
}
.planner-toast.error { background: #8a2d2d; }
.planner-toast[hidden] { display: none; }
