:root {
  --bg: #f4efe6;
  --panel: #fffaf3;
  --text: #231c15;
  --muted: #564a3c;
  --line: #ddd0bf;
  --primary: #1f1a17;
  --primary-strong: #110d0a;
  --mint: #d7dfcf;
  --peach: #ecd9b2;
  --lilac: #e7ddd1;
  --rose: #e7cec3;
  --warning: #c9983c;
  --shadow: 0 14px 32px rgba(96, 77, 46, 0.08);
  --radius: 16px;
  --font-size-base: 1rem;
  --line-height-base: 1.62;
}

* { box-sizing: border-box; }

html {
  font-size: 16px;
}

body {
  margin: 0;
  font-family: "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  font-size: var(--font-size-base);
  line-height: var(--line-height-base);
  background: var(--bg);
  color: var(--text);
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

a { color: inherit; text-decoration: none; }

p,
li,
td,
th,
label,
input,
select,
textarea,
button {
  line-height: 1.55;
}

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

.sidebar {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 58px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 250, 243, 0.92);
  backdrop-filter: blur(8px);
  overflow: visible;
}

.brand {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  height: 100%;
}

.brand-title {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.brand-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(120deg, #c39a43, #89936a);
  box-shadow: 0 0 0 4px rgba(195, 154, 67, 0.18);
}

.menu-toggle {
  border: 0;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 6px 10px;
  color: var(--muted);
}

.nav {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  left: 10px;
  right: 10px;
  padding: 0 10px 12px;
  gap: 6px;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fffaf3;
  box-shadow: var(--shadow);
}

.nav.open { display: flex; }

.nav-link {
  padding: 10px 12px;
  border-radius: 12px;
  color: #6a5d4d;
  font-weight: 600;
}

.nav-link:hover {
  background: #f0e7da;
}

.nav-link.active {
  background: linear-gradient(120deg, #eee2cf, #edf1e2);
  color: #4f4231;
}

.main {
  padding: 14px;
  margin-top: 0;
  background: var(--bg);
}

.navbar .nav-link {
  border-radius: 10px;
  font-weight: 650;
  font-size: 0.97rem;
  color: #5f5244;
}

.navbar-brand {
  color: #282119 !important;
  font-size: 1.1rem;
  letter-spacing: 0.01em;
}

.navbar .nav-link:hover {
  background: #f0e7da;
  color: #282119;
}

.navbar .nav-link.active {
  background: #eee2cf;
  color: #4f4231;
}

.navbar {
  background: rgba(255, 250, 243, 0.94) !important;
  border-bottom-color: #ddd0bf !important;
}

.topbar {
  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}

.page-title { margin: 0; font-size: 1.58rem; font-weight: 700; color: #282119; letter-spacing: -0.01em; }
.page-desc { margin: 6px 0 0; color: var(--muted); font-size: 0.98rem; line-height: 1.65; }

.page-title i {
  margin-right: 8px;
  color: #b58c39;
}

.title-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.actions {
  display: flex;
  gap: 8px;
}

.user-chip {
  border: 1px solid var(--line);
  background: #fffaf3;
  border-radius: 999px;
  padding: 8px 10px;
  font-size: 0.85rem;
  color: #5f5244;
  font-weight: 700;
}

.btn {
  border: 0;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
  cursor: pointer;
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  border: 1px solid var(--primary);
  box-shadow: none;
}

.btn-soft {
  background: #f6eee1;
  color: #514537;
  border: 1px solid #d7c8b4;
}

.btn:hover {
  filter: none;
}

.btn-primary:hover {
  background: var(--primary-strong);
  border-color: var(--primary-strong);
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.cols-2,
.grid.cols-3,
.grid.cols-4 {
  grid-template-columns: 1fr;
}

/* Mobile dashboard KPI: keep 3 cards in one row */
#dashboard-page.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

@media (max-width: 768px) {
  #dashboard-page .kpi-item {
    padding: 8px;
  }

  #dashboard-page .kpi-label {
    font-size: 0.76rem;
    margin-bottom: 2px;
  }

  #dashboard-page .kpi-value {
    font-size: 1rem;
  }
}

.card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 16px;
}

.card h3 {
  margin: 0 0 10px;
  font-size: 1.16rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #212529;
}

.card h3 i {
  color: #b58c39;
}

.muted { color: var(--muted); font-size: 0.96rem; line-height: 1.6; }
.kpi {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.kpi-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fff;
}

.kpi-clickable {
  cursor: pointer;
}

.kpi-clickable:focus-visible {
  outline: 2px solid rgba(181, 140, 57, 0.38);
  outline-offset: 2px;
}

.kpi-label { font-size: 0.92rem; color: var(--muted); margin-bottom: 4px; line-height: 1.45; }
.kpi-value { font-size: 1.32rem; font-weight: 700; color: #212529; line-height: 1.3; }

.kpi-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.kpi-star-open-btn {
  padding: 2px 8px;
  font-size: 0.75rem;
  line-height: 1.2;
  color: #3f3429 !important;
  font-weight: 700;
}

.dashboard-update-trigger {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #1f1a17;
  border: 1px solid #1f1a17;
  font-size: 0.82rem;
  font-weight: 800;
  color: #fff7ea;
  box-shadow: 0 10px 24px rgba(63, 44, 24, 0.12);
}

.dashboard-update-trigger:hover,
.dashboard-update-trigger:focus {
  background: #110d0a;
  border-color: #110d0a;
}

.dashboard-update-modal {
  border: 1px solid #d8c9b6;
  border-radius: 18px;
  overflow: hidden;
}

.dashboard-update-modal .modal-header {
  background:
    radial-gradient(circle at top right, rgba(195, 154, 67, 0.18), transparent 34%),
    linear-gradient(135deg, #f6ecdd, #f3f1e5);
  border-bottom: 1px solid #d8c9b6;
}

.dashboard-update-modal .modal-title {
  color: #3c3126 !important;
}

.dashboard-update-list {
  margin: 0;
  padding-left: 18px;
  color: #43382d;
}

.dashboard-update-list li + li {
  margin-top: 6px;
}

.dashboard-update-list li {
  font-size: 0.96rem;
  line-height: 1.65;
}

.period-switch {
  display: inline-flex;
  background: #e8dccb;
  border-radius: 12px;
  padding: 4px;
  gap: 4px;
}

.period-btn {
  border: 0;
  background: transparent;
  border-radius: 8px;
  padding: 6px 9px;
  font-weight: 700;
  color: #6a5d4d;
}

.period-btn.active {
  background: #fffaf3;
  color: #282119;
  box-shadow: 0 1px 0 rgba(50, 63, 95, 0.08);
}

.chart-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.chart-controls {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chart {
  margin-top: 12px;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  align-items: end;
  height: 170px;
}

.bar {
  border-radius: 12px 12px 8px 8px;
  background: linear-gradient(180deg, #c39a43, #ead7af);
  position: relative;
}

.bar::after {
  content: attr(data-label);
  position: absolute;
  bottom: -24px;
  width: 100%;
  text-align: center;
  font-size: 0.72rem;
  color: #5f5244;
}

.list {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 8px;
}

.list li {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fff;
}

.list-pagination {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
}

.pagination-summary {
  font-size: 0.84rem;
  color: #5b5042;
}

.pagination-controls {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pagination-nav-btn,
.pagination-page-btn {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
  border-radius: 10px;
  min-width: 40px;
  padding: 7px 10px;
  font-size: 0.86rem;
  font-weight: 700;
}

.pagination-nav-btn[disabled],
.pagination-page-btn[disabled] {
  opacity: 0.5;
  cursor: default;
}

.pagination-page-btn.active {
  background: #e8dbc4;
  border-color: #d0b17a;
  color: #4f4231;
}

.tag {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}

.tag.mint { background: #dce7d4; color: #526345; }
.tag.peach { background: #f2e0bd; color: #6a4d1e; }
.tag.lilac { background: #e7ddd1; color: #6b5646; }
.tag.rose { background: #edd8d0; color: #8a5648; }

.table-wrap { overflow: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
}

th { color: #544739; font-weight: 700; }

.form-row {
  display: grid;
  gap: 10px;
  grid-template-columns: 1fr;
}

.form-grid-12 {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(12, minmax(0, 1fr));
}

.col-12 { grid-column: span 12; }
.col-6 { grid-column: span 12; }

/* Prevent Bootstrap's .col-* width rules from shrinking grid items in our 12-col form grid */
.form-grid-12 > .col-12,
.form-grid-12 > .col-6 {
  width: 100%;
  max-width: none;
  min-width: 0;
}

.target-label {
  margin-bottom: 0;
}

.target-item {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.target-radio {
  margin: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 52px;
  font-weight: 700;
  color: #4c4135;
  cursor: pointer;
  background: transparent;
  border: 0;
  border-radius: 0;
  padding: 0;
}

.target-radio input[type="radio"] {
  width: auto;
  margin: 0;
}

.target-value-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.target-value-wrap input[type="number"] {
  min-width: 0;
}

.target-unit {
  color: #6a5d4d;
  font-size: 0.9rem;
  font-weight: 600;
  white-space: nowrap;
}

label {
  display: inline-flex;
  align-items: center;
  font-size: 0.9rem;
  color: #4f4336;
  margin-bottom: 6px;
  font-weight: 700;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 999px;
  padding: 3px 10px;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 500;
  background: #fff;
  color: #212529;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: #c9aa6c;
  box-shadow: 0 0 0 0.2rem rgba(181, 140, 57, 0.16);
}

input[type="date"] {
  display: block;
  width: 100%;
  min-width: 0;
  max-width: 100%;
  inline-size: 100%;
  box-sizing: border-box;
  -webkit-appearance: none;
  appearance: none;
}

input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 1;
  filter: invert(92%) sepia(18%) saturate(317%) hue-rotate(184deg) brightness(102%) contrast(95%);
}

.plan-date-row {
  align-items: stretch;
}

.plan-date-row .col-6 {
  min-width: 0;
}

.plan-date-row input[type="date"] {
  width: 100% !important;
  min-width: 0 !important;
  max-width: none !important;
  inline-size: 100% !important;
  box-sizing: border-box;
}

textarea { min-height: 90px; resize: vertical; }

form .btn-primary {
  margin-top: 4px;
}

.form-row,
.row.g-3 {
  row-gap: 12px !important;
}

.auth-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 16px;
}

.auth-card {
  width: min(460px, 100%);
}

.note {
  background: #f4ead8;
  border: 1px solid #ddc39a;
  border-radius: 12px;
  color: #5f4a26;
  padding: 10px 12px;
  font-size: 0.92rem;
  line-height: 1.6;
}

.video-source-switch {
  display: inline-grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  width: 100%;
  gap: 6px;
  margin-bottom: 14px;
}

.video-source-tab {
  border: 1px solid var(--line);
  background: #f6eee1;
  color: #5b4f41;
  border-radius: 12px;
  padding: 10px 12px;
  font-weight: 700;
}

.video-source-tab.active {
  background: #e6d5b6;
  color: #44382a;
  border-color: #c9b18a;
}

.video-source-panel[hidden] {
  display: none !important;
}

.video-policy-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}

.video-policy-item,
.video-upload-summary {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fffdf8;
}

.video-policy-item {
  padding: 12px;
}

.video-policy-item strong {
  display: block;
  font-size: 1rem;
  color: var(--text);
}

.video-policy-label {
  display: block;
  margin-bottom: 4px;
  font-size: 0.85rem;
  color: #5e5244;
  font-weight: 700;
}

.video-upload-summary {
  min-height: 78px;
  padding: 12px;
}

.video-upload-summary strong {
  color: var(--text);
}

.video-upload-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin-top: 10px;
}

.video-upload-meta span {
  display: block;
  border-radius: 10px;
  background: #fff7ec;
  border: 1px solid var(--line);
  padding: 8px 10px;
  font-size: 0.86rem;
  color: #5a4f42;
}

.video-upload-meta strong {
  display: block;
  margin-top: 3px;
  font-size: 0.92rem;
  color: var(--text);
}

.video-upload-summary.is-ok {
  border-color: #b8c5a5;
  background: #eef3e9;
}

.video-upload-summary.is-warn {
  border-color: #d9b86e;
  background: #fbf0db;
}

.video-upload-summary.is-error {
  border-color: #d2a392;
  background: #f7e8e3;
}

.video-upload-tip {
  margin: 0;
  color: #5c5143;
  font-size: 0.92rem;
}

.video-upload-busy {
  overflow: hidden;
}

.video-upload-busy-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(29, 24, 19, 0.42);
  backdrop-filter: blur(2px);
}

.video-upload-busy-dialog {
  width: min(92vw, 360px);
  border-radius: 18px;
  border: 1px solid #d9c7aa;
  background: #fffaf2;
  box-shadow: 0 20px 50px rgba(29, 24, 19, 0.18);
  padding: 22px 20px;
  text-align: center;
  color: #46382b;
}

.video-upload-busy-dialog strong {
  display: block;
  margin-bottom: 8px;
  font-size: 1rem;
}

.video-upload-busy-dialog p {
  margin: 0;
  color: #6a5a47;
  line-height: 1.5;
}

.video-upload-busy-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 4px solid #eadcc6;
  border-top-color: #c79d56;
  animation: video-upload-spin 0.9s linear infinite;
}

@keyframes video-upload-spin {
  to {
    transform: rotate(360deg);
  }
}

.video-source-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  background: #f2e7d4;
  border: 1px solid #dac8ad;
  color: #5a4b37;
  font-size: 0.78rem;
  font-weight: 700;
}

.video-status-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 10px;
  font-size: 0.78rem;
  font-weight: 700;
  border: 1px solid transparent;
}

.video-status-badge.is-ready {
  background: #edf3e7;
  border-color: #b8c5a5;
  color: #51683e;
}

.video-status-badge.is-processing,
.video-status-badge.is-pending {
  background: #fbf0db;
  border-color: #d9b86e;
  color: #826123;
}

.video-status-badge.is-failed {
  background: #f7e8e3;
  border-color: #d2a392;
  color: #9f5e52;
}

.video-processing-box {
  margin-bottom: 8px;
  border-radius: 12px;
  border: 1px dashed #d4c1a1;
  background: #fff8eb;
  padding: 14px 16px;
  color: #5c4e3b;
}

.video-processing-box strong {
  display: block;
  color: #46382b;
}

.video-processing-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.video-progress-text {
  flex-shrink: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: #7a6336;
}

.video-processing-box p {
  margin: 0;
  line-height: 1.5;
}

.video-progress {
  position: relative;
  margin-top: 12px;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #efe1c8;
  border: 1px solid #dcc6a3;
}

.video-progress-bar {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #c8a15b, #e6c687);
  transition: width 0.35s ease;
}

.video-item-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.video-item-meta span {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 4px 9px;
  border-radius: 999px;
  background: #fff7ec;
  border: 1px solid #e2d2bd;
  color: #5d4f3d;
  font-size: 0.82rem;
  font-weight: 700;
}

@media (max-width: 640px) {
  .list-pagination {
    align-items: stretch;
  }

  .pagination-controls {
    width: 100%;
  }

  .video-upload-meta {
    grid-template-columns: 1fr;
  }
}

.feedback {
  min-height: 1rem;
  margin: 0;
  font-size: 0.9rem;
  color: #5f5549;
}

.feedback.success { color: #2c7a63; }
.feedback.error { color: #b06758; }

.btn-group {
  display: inline-flex;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #fff;
}

.btn-check {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.btn-outline-primary {
  border-radius: 0;
  background: #fffaf3;
  color: #5f5244;
  border: 0;
  padding: 9px 12px;
  min-width: 88px;
}

.btn-outline-primary:hover {
  background: #efe4d5;
}

.btn-check:checked + .btn-outline-primary {
  background: #1f1a17;
  color: #fff7ea;
}

.line-chart-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.line-chart-wrap {
  display: block;
}

.line-scroll {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  position: relative;
}

.google-line-chart {
  width: 100%;
  min-height: 280px;
  position: relative;
}

.google-hover-tooltip {
  position: absolute;
  z-index: 10;
  display: none;
  min-width: 180px;
  max-width: 390px;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid #d4c2a8;
  background: rgba(255, 250, 243, 0.99);
  color: #2e261e;
  font-size: 0.84rem;
  line-height: 1.55;
  box-shadow: 0 10px 24px rgba(88, 67, 38, 0.14);
  pointer-events: none;
  white-space: pre-line;
}

/* Google Charts native tooltip */
div.google-visualization-tooltip {
  min-width: 270px !important;
  max-width: none !important;
  width: max-content !important;
  white-space: nowrap !important;
}

.chart-tooltip-content {
  white-space: nowrap;
}

.x-label-star {
  position: absolute;
  font-size: 14px;
  line-height: 1;
  white-space: nowrap;
  text-align: center;
  transform: translateX(-50%);
  pointer-events: none;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
}

.x-label-star.star-fill {
  color: #f2c23b;
}

.x-label-star.star-half {
  color: #f2c23b;
}

.goal-baseline-line {
  position: absolute;
  height: 5px;
  border-radius: 999px;
  background: #f2c23b;
  transform: translateY(-50%);
  pointer-events: none;
  z-index: 0;
}

.month-calendar-view {
  margin-top: 8px;
}

.month-calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}

.month-calendar-head {
  font-size: 0.78rem;
  color: #40352a;
  text-align: center;
  font-weight: 700;
  padding-bottom: 4px;
}

.month-day-cell {
  min-height: 76px;
  border: 1px solid #5c6578;
  border-radius: 10px;
  background: var(--panel);
  padding: 6px 6px 4px;
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  cursor: pointer;
}

.month-day-num {
  font-size: 0.82rem;
  color: #241d16;
  font-weight: 700;
}

.month-day-stars {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 1.6rem;
  color: #f2c23b;
  line-height: 1;
  display: inline-flex;
  gap: 2px;
}

.month-day-empty {
  min-height: 76px;
}

@media (max-width: 768px) {
  .month-calendar-grid {
    gap: 6px;
  }

  .month-day-cell,
  .month-day-empty {
    min-height: 62px;
  }

  .month-day-num {
    font-size: 0.74rem;
  }

  .month-day-stars {
    font-size: 1.4rem;
  }
}

@media (min-width: 900px) {
  .app {
    grid-template-columns: 250px 1fr;
  }

  .sidebar {
    position: sticky;
    height: 100vh;
    border-bottom: 0;
    border-right: 1px solid var(--line);
    padding-top: 10px;
    overflow: auto;
  }

  .brand { padding: 14px; }
  .menu-toggle { display: none; }
  .nav {
    display: flex;
    position: static;
    top: auto;
    left: auto;
    right: auto;
    border: 0;
    border-radius: 0;
    background: transparent;
    box-shadow: none;
    padding: 0 10px 12px;
  }
  .main {
    padding: 24px;
    margin-top: 0;
  }

  .grid.cols-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }

  .form-row.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .col-6 { grid-column: span 6; }
}

/* Global theme refinement */
:root {
  --bg: #f4efe6;
  --panel: #fffaf3;
  --text: #282119;
  --muted: #7c705f;
  --line: #ddd0bf;
}

body,
.main {
  background: var(--bg);
  color: var(--text);
}

.navbar {
  background: rgba(255, 250, 243, 0.94) !important;
  border-bottom-color: #ddd0bf !important;
}

.navbar-brand {
  color: #282119 !important;
  margin-right: 0.2rem;
}

.brand-group {
  display: inline-flex;
  align-items: center;
}

.navbar .nav-link {
  color: #625647;
}

.navbar .nav-link:hover {
  background: #f0e7da;
  color: #282119;
}

.navbar .nav-link.active {
  background: #eee2cf;
  color: #514537;
}

.navbar-toggler {
  border-color: #c7b59d;
}

.navbar-toggler:focus {
  box-shadow: 0 0 0 0.2rem rgba(181, 140, 57, 0.2);
}

.navbar-toggler-icon {
  filter: invert(19%) sepia(9%) saturate(849%) hue-rotate(355deg) brightness(95%) contrast(92%);
}

.brand-actions {
  display: inline-flex;
  align-items: center;
  margin-left: 8px;
}

.brand-plus-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 0;
  color: #514537;
  background: transparent;
  box-shadow: none !important;
}

.brand-plus-btn:hover,
.brand-plus-btn:focus {
  color: #282119;
  background: #efe4d5;
  border: 0;
  box-shadow: none !important;
}

.install-menu .dropdown-item {
  color: #514537;
}

.install-menu .dropdown-item:hover,
.install-menu .dropdown-item:focus {
  color: #282119;
  background: #efe4d5;
}

.brand-plus-btn.dropdown-toggle::after {
  display: none;
}

li.nav-item {
  margin: 0 4px;
}

.brand-actions {
  margin-left: 0;
}

.page-title,
.card h3,
.kpi-value {
  color: #282119;
}

.user-chip {
  background: #fffaf3;
  color: #5f5244;
}

.card,
.kpi-item,
.list li,
.pagination-nav-btn,
.pagination-page-btn,
.target-item,
.line-scroll,
.btn-group {
  background: var(--panel);
  border-color: var(--line);
}

.target-radio {
  color: #4f4336;
}

.target-unit {
  color: #8a7b67;
}

label {
  color: #645646;
  background: #f2eadf;
  border-color: #dfcfbd;
}

input,
select,
textarea {
  background: #fffdf9;
  color: #282119;
  border-color: var(--line);
}

input:focus,
select:focus,
textarea:focus {
  border-color: #c9aa6c;
  box-shadow: 0 0 0 0.2rem rgba(181, 140, 57, 0.16);
}

.btn-soft {
  background: #f6eee1;
  color: #514537;
  border: 1px solid #d7c8b4;
}

.btn-soft:hover,
.btn-soft:focus,
.btn-soft:active {
  color: #282119 !important;
  background: #efe3d0 !important;
  border-color: #cbb699 !important;
  box-shadow: none !important;
}

#period-prev-btn,
#period-next-btn {
  background: #f6eee1 !important;
  color: #514537 !important;
  border-color: #d7c8b4 !important;
}

#period-prev-btn:hover,
#period-next-btn:hover,
#period-prev-btn:focus,
#period-next-btn:focus,
#period-prev-btn:active,
#period-next-btn:active {
  background: #efe3d0 !important;
  color: #282119 !important;
  border-color: #cbb699 !important;
  box-shadow: none !important;
}

#plan-list .btn-soft:hover,
#plan-list .btn-soft:focus {
  color: #282119 !important;
  background: #efe3d0 !important;
  border-color: #cbb699 !important;
}

.period-switch {
  background: #e8dccb;
}

.period-btn {
  color: #6a5d4d;
}

.period-btn.active {
  background: #fffaf3;
  color: #282119;
}

.dashboard-update-trigger {
  background: #1f1a17;
  border-color: #1f1a17;
  color: #fff6ea;
}

.dashboard-update-list {
  color: #43382d;
}

.dashboard-update-trigger:hover,
.dashboard-update-trigger:focus {
  background: #110d0a;
  border-color: #110d0a;
}

.dashboard-update-modal {
  border-color: #d8c9b6;
  background: #fffaf3;
}

.dashboard-update-modal .modal-header {
  background:
    radial-gradient(circle at top right, rgba(195, 154, 67, 0.18), transparent 34%),
    linear-gradient(135deg, #f6ecdd, #f3f1e5);
  border-bottom-color: #d8c9b6;
}

.dashboard-update-modal .modal-title {
  color: #3c3126 !important;
}

.pagination-page-btn.active {
  background: #e8dbc4;
  border-color: #d0b17a;
  color: #4f4231;
}

.note {
  background: #f4ead8;
  border-color: #ddc39a;
  color: #5f4a26;
}

.video-source-tab {
  background: #f6eee1;
  color: #5b4f41;
  border-color: #d7c8b4;
}

.video-source-tab.active {
  background: #e6d5b6;
  color: #44382a;
  border-color: #c9b18a;
}

.video-policy-item,
.video-upload-summary {
  background: #fffdf8;
  border-color: #ddd0bf;
}

.video-upload-meta span {
  background: #fff7ec;
  border-color: #e2d2bd;
}

.video-upload-summary.is-ok {
  background: #eef3e9;
  border-color: #b8c5a5;
}

.video-upload-summary.is-warn {
  background: #fbf0db;
  border-color: #d9b86e;
}

.video-upload-summary.is-error {
  background: #f7e8e3;
  border-color: #d2a392;
}

th {
  color: #544739;
}

.feedback.success { color: #5f7a4b; }
.feedback.error { color: #b06758; }

.item-delete-btn {
  align-self: center;
  justify-self: end;
  font-size: 0.8rem;
  color: #b06758;
  background: #fbf1ed;
  border: 1px solid #dcc0b6;
  border-radius: 999px;
  padding: 2px 8px;
  line-height: 1.2;
}

[data-plan-delete],
[data-route-delete],
[data-video-delete],
[data-session-delete],
.item-delete-btn {
  color: #b06758 !important;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

[data-plan-delete]:hover,
[data-route-delete]:hover,
[data-video-delete]:hover,
[data-session-delete]:hover,
.item-delete-btn:hover {
  color: #8e4f42 !important;
  background: #f4e1da !important;
  border-color: #cfa292 !important;
}

[data-plan-delete]:focus,
[data-route-delete]:focus,
[data-video-delete]:focus,
[data-session-delete]:focus,
.item-delete-btn:focus,
[data-plan-delete]:active,
[data-route-delete]:active,
[data-video-delete]:active,
[data-session-delete]:active,
.item-delete-btn:active {
  color: #8e4f42 !important;
}

/* Record screen readability guard */
#record-list,
#record-plan-entries,
#record-list *,
#record-plan-entries * {
  color: var(--text);
}

#record-list .muted,
#record-plan-entries .muted,
#record-list .feedback,
#record-plan-entries .feedback {
  color: var(--muted) !important;
}

#record-list .feedback.success,
#record-plan-entries .feedback.success {
  color: #5f7a4b !important;
}

#record-list .feedback.error,
#record-plan-entries .feedback.error {
  color: #b06758 !important;
}

#video-list [data-video-fill] {
  color: var(--text) !important;
}

#video-list [data-video-fill]:hover,
#video-list [data-video-fill]:focus {
  color: #514537 !important;
}

/* Fallback for old inline dark text colors */
[style*="color:#2f"],
[style*="color: #2f"],
[style*="color:#21"],
[style*="color: #21"],
[style*="color:#49"],
[style*="color: #49"] {
  color: var(--text) !important;
}

/* Keep Bootstrap modal readable on white modal surface */
.modal-content {
  color: #282119;
  background: #fffaf3;
}

.modal-title {
  color: #282119 !important;
}

#starCalendarModal .modal-content {
  background: #fffaf3;
  border: 1px solid #ddd0bf;
}

#starCalendarModal .modal-dialog.modal-dialog-centered {
  min-height: calc(100% - 40px);
  align-items: flex-start;
  margin-top: 40px;
}

#starCalendarModal .modal-header {
  background: #fff8ee;
  border-bottom-color: #e2d5c5;
}

#starCalendarModal .star-calendar-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

#starCalendarModal #star-calendar-prev,
#starCalendarModal #star-calendar-next {
  border-color: #d1c0a9;
  color: #5a4d3e;
  background: #fffaf3;
  min-width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

#starCalendarModal #star-calendar-prev:hover,
#starCalendarModal #star-calendar-next:hover {
  background: #f2e7d8;
  color: #2f261f;
}

#starCalendarModal #star-calendar-next[disabled] {
  opacity: 0.4;
}

#starCalendarModal .modal-body {
  background: #ffffff;
}

#starCalendarModal .month-calendar-head {
  color: #40352a;
}

#starCalendarModal .month-day-cell {
  background: #ffffff;
  border-color: #c7d0e0;
  cursor: default;
}

#starCalendarModal .month-day-num {
  color: #273245;
}
