:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --panel: #ffffff;
  --panel-soft: #faf8f2;
  --ink: #1d2521;
  --muted: #6d746f;
  --line: #d9d3c8;
  --accent: #2f6f62;
  --accent-strong: #24564c;
  --warm: #b06b32;
  --danger: #b3261e;
  --green-soft: #e8f4ef;
  --yellow-soft: #fff4d8;
  --red-soft: #fdebea;
  --shadow: 0 18px 55px rgba(29, 37, 33, 0.16);
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Yu Gothic", "YuGothic", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background:
    linear-gradient(90deg, rgba(47, 111, 98, 0.05) 1px, transparent 1px) 0 0 / 72px 72px,
    linear-gradient(180deg, #f8f5ee, var(--bg));
  color: var(--ink);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  min-height: 112px;
  padding: 22px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(250, 248, 242, 0.92);
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  border: 2px solid var(--ink);
  background: var(--panel);
  color: var(--accent);
  font-size: 28px;
  font-weight: 800;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--warm);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 4px;
  font-size: 28px;
  line-height: 1.2;
}

h2 {
  margin-bottom: 6px;
  font-size: 22px;
}

h3 {
  margin-bottom: 0;
  font-size: 16px;
}

.storage-status,
.section-note {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 13px;
}

.header-actions,
.view-actions,
.dialog-actions,
.month-control {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-button,
.text-button,
.danger-button,
.icon-button {
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 5px;
  padding: 8px 13px;
  font-weight: 700;
}

.primary-button {
  background: var(--accent);
  color: #fff;
  box-shadow: 0 2px 0 var(--accent-strong);
}

.primary-button.compact {
  min-height: 34px;
  padding: 6px 11px;
}

.text-button {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.file-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.file-button input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.danger-button {
  border-color: #efc6c2;
  background: var(--red-soft);
  color: var(--danger);
}

.icon-button {
  width: 38px;
  padding: 0;
  border-color: var(--line);
  background: var(--panel);
  font-size: 22px;
}

.app-tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  gap: 4px;
  overflow-x: auto;
  padding: 8px 32px;
  border-bottom: 1px solid var(--line);
  background: rgba(244, 241, 234, 0.96);
}

.app-tab {
  min-height: 36px;
  border: 1px solid transparent;
  border-radius: 4px;
  padding: 7px 12px;
  background: transparent;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}

.app-tab.active {
  border-color: var(--line);
  background: var(--panel);
  color: var(--ink);
}

.approval-tab {
  margin-left: auto;
  border-color: #ead6bf;
  background: #fff5e8;
  color: #7c4810;
}

.app-shell {
  max-width: 1540px;
  margin: 0 auto;
  padding: 24px 24px 48px;
}

.app-view {
  display: none;
  min-height: calc(100vh - 210px);
  border-top: 4px solid var(--accent);
  background: rgba(255, 255, 255, 0.65);
  padding: 24px;
}

.app-view.active {
  display: block;
}

.view-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 5px;
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
}

textarea {
  resize: vertical;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 22px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.summary-card {
  min-height: 92px;
  padding: 16px;
  border-right: 1px solid var(--line);
}

.summary-card:last-child {
  border-right: 0;
}

.summary-card strong {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 12px;
}

.summary-card span {
  font-size: 30px;
  font-weight: 800;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 0.9fr);
  gap: 18px;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 15px 16px;
  border-bottom: 1px solid var(--line);
}

.item-list,
.idea-list {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.item-card,
.idea-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  background: var(--panel-soft);
  padding: 12px;
}

.approval-alert {
  margin: 9px 0;
  border-left: 4px solid var(--danger);
  background: var(--red-soft);
  color: var(--danger);
  padding: 8px 10px;
  font-size: 13px;
  font-weight: 800;
}

.item-card header,
.idea-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.item-card strong,
.idea-card strong {
  display: block;
  line-height: 1.35;
}

.meta-line {
  color: var(--muted);
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 3px;
  padding: 3px 7px;
  background: var(--green-soft);
  color: var(--accent-strong);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.badge.hold {
  background: var(--yellow-soft);
  color: #83500f;
}

.badge.done {
  background: #e6ece9;
  color: #4b5852;
}

.board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(190px, 1fr);
  gap: 10px;
  overflow-x: auto;
  padding-bottom: 12px;
}

.board-column {
  min-width: 190px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.board-column h3 {
  padding: 12px;
  border-bottom: 1px solid var(--line);
}

.board-column-body {
  display: grid;
  gap: 9px;
  min-height: 180px;
  padding: 10px;
  transition: background 0.15s ease, outline-color 0.15s ease;
}

.board-column-body.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -5px;
  background: var(--green-soft);
}

.board-card {
  border: 1px solid var(--line);
  background: var(--panel-soft);
  padding: 10px;
  cursor: grab;
  user-select: none;
}

.board-card:active {
  cursor: grabbing;
}

.board-card.dragging {
  opacity: 0.45;
}

.board-card button,
.item-card button,
.idea-card button {
  margin-top: 8px;
}

.weekday-row,
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.weekday-row {
  border: 1px solid var(--line);
  border-bottom: 0;
  background: var(--panel);
}

.weekday-row span {
  padding: 9px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-align: center;
}

.calendar-grid {
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
  background: var(--panel);
}

.calendar-day {
  min-height: 132px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  padding: 8px;
  transition: background 0.15s ease, outline-color 0.15s ease;
}

.calendar-day.muted {
  background: #f4f2ec;
  color: var(--muted);
}

.calendar-day.saturday {
  background: #eef6fb;
}

.calendar-day.sunday,
.calendar-day.holiday {
  background: #fff0ed;
}

.calendar-day.muted.saturday {
  background: #eef1f2;
}

.calendar-day.muted.sunday,
.calendar-day.muted.holiday {
  background: #f3ece8;
}

.calendar-day.drag-over {
  outline: 2px dashed var(--accent);
  outline-offset: -5px;
  background: var(--green-soft);
}

.calendar-date {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 6px;
  font-size: 12px;
  font-weight: 800;
}

.calendar-date b {
  color: var(--ink);
}

.calendar-day.saturday .calendar-date b {
  color: #24658b;
}

.calendar-day.sunday .calendar-date b,
.calendar-day.holiday .calendar-date b {
  color: var(--danger);
}

.calendar-date em {
  overflow: hidden;
  color: var(--danger);
  font-size: 10px;
  font-style: normal;
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.calendar-video {
  display: block;
  width: 100%;
  margin-top: 5px;
  border: 0;
  border-left: 3px solid var(--warm);
  background: var(--panel-soft);
  padding: 5px;
  color: var(--ink);
  cursor: grab;
  font-size: 12px;
  text-align: left;
}

.calendar-video:active {
  cursor: grabbing;
}

.calendar-video.dragging {
  opacity: 0.45;
}

.filters {
  display: grid;
  grid-template-columns: minmax(145px, 0.55fr) 1.5fr repeat(3, minmax(150px, 0.5fr));
  gap: 12px;
  margin-bottom: 16px;
}

label span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--panel);
}

.video-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
}

.video-table th,
.video-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px;
  font-size: 13px;
  text-align: left;
  vertical-align: top;
}

.video-table th {
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 12px;
}

.empty-state,
.empty-cell {
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.idea-form {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(160px, 220px) auto;
  gap: 10px;
  align-items: start;
  margin-bottom: 16px;
}

.idea-form textarea {
  grid-column: 1 / 3;
}

.edit-dialog,
.message-dialog {
  width: min(900px, calc(100vw - 28px));
  border: 1px solid var(--line);
  padding: 0;
  box-shadow: var(--shadow);
}

.message-dialog {
  width: min(420px, calc(100vw - 28px));
}

.message-dialog div {
  padding: 24px;
}

.edit-form {
  padding: 22px;
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 13px;
}

.field-grid .wide {
  grid-column: 1 / -1;
}

.dialog-actions {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  margin-top: 18px;
}

a {
  color: var(--accent-strong);
}

@media (max-width: 980px) {
  .app-header,
  .view-heading {
    flex-direction: column;
    align-items: stretch;
  }

  .approval-tab {
    margin-left: 0;
  }

  .summary-strip,
  .dashboard-grid,
  .filters,
  .field-grid,
  .idea-form {
    grid-template-columns: 1fr;
  }

  .idea-form textarea {
    grid-column: auto;
  }

  .app-shell,
  .app-view {
    padding: 16px;
  }
}
