html {
  font-size: 15px;
  min-height: 100%;
}

body {
  background: #f5f7fa;
  color: #1d2733;
  display: flex;
  flex-direction: column;
  font-family: "Segoe UI", "Malgun Gothic", Arial, sans-serif;
  min-height: 100vh;
}

body > .container {
  flex: 1 0 auto;
}

.navbar {
  box-shadow: 0 1px 8px rgba(29, 39, 51, 0.06);
}

.footer {
  background: #fff;
  flex-shrink: 0;
  line-height: 60px;
  margin-top: 32px;
  width: 100%;
}

.btn-primary {
  background: #1f6feb;
  border-color: #1f6feb;
}

.page-heading {
  align-items: center;
  display: flex;
  gap: 16px;
  justify-content: space-between;
  margin: 22px 0 20px;
}

.page-heading h1 {
  font-size: 28px;
  font-weight: 700;
  margin: 0;
}

.eyebrow {
  color: #667085;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  margin: 0 0 4px;
  text-transform: uppercase;
}

.metric-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 16px;
}

.metric,
.table-wrap,
.form-panel,
.detail-panel,
.login-panel {
  background: #fff;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(29, 39, 51, 0.05);
}

.metric {
  padding: 18px;
}

.metric span {
  color: #667085;
  display: block;
  font-size: 13px;
}

.metric strong {
  display: block;
  font-size: 30px;
  margin-top: 6px;
}

.weekly-plan-panel {
  background: #fff;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(29, 39, 51, 0.05);
  margin-bottom: 16px;
  padding: 18px;
}

.weekly-plan-head {
  align-items: center;
  border-bottom: 1px solid #e6ebf1;
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  padding-bottom: 12px;
}

.weekly-plan-head h2 {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
}

.weekly-plan-head p {
  color: #667085;
  font-size: 13px;
  margin: 4px 0 0;
}

.weekly-plan-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.weekly-plan-card {
  min-width: 0;
}

.weekly-plan-card h3 {
  color: #1d2733;
  font-size: 16px;
  font-weight: 800;
  margin: 0 0 10px;
}

.weekly-plan-record {
  border-top: 1px solid #e6ebf1;
  padding: 10px 0 0;
}

.weekly-plan-record:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.weekly-plan-item {
  border: 1px solid #2f6fb3;
  border-radius: 0;
  margin-bottom: 10px;
  overflow: hidden;
}

.weekly-plan-item-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
}

.weekly-plan-item-head span {
  background: #eef3f8;
  border-bottom: 1px solid #2f6fb3;
  color: #1d2733;
  font-size: 13px;
  font-weight: 800;
  padding: 8px 10px;
}

.weekly-plan-item-head span + span {
  border-left: 1px solid #2f6fb3;
  text-align: center;
}

.weekly-plan-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  min-height: 90px;
}

.weekly-plan-content {
  font-size: 14px;
  overflow-wrap: anywhere;
  padding: 10px;
  white-space: pre-line;
}

.weekly-plan-content p:last-child {
  margin-bottom: 0;
}

.weekly-plan-note {
  background: #fff;
  border-left: 1px solid #2f6fb3;
  color: #465365;
  font-size: 13px;
  overflow-wrap: anywhere;
  padding: 10px;
  white-space: pre-line;
}

.weekly-plan-empty {
  color: #667085;
  padding: 16px 0 2px;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
}

.toolbar .btn {
  min-width: 84px;
  white-space: nowrap;
}

.previous-panel {
  background: #fff;
  border: 1px solid #dde3ea;
  border-radius: 8px;
  margin-bottom: 16px;
  max-width: 50%;
  padding: 16px;
}

.date-picker-popover {
  background: #fff;
  border: 1px solid #cfd8e3;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(29, 39, 51, 0.18);
  display: none;
  padding: 10px;
  position: absolute;
  width: 252px;
  z-index: 2000;
}

.date-picker-popover.open {
  display: block;
}

.date-picker-head {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
}

.date-picker-head button {
  background: #f8fafc;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  height: 30px;
  width: 34px;
}

.date-picker-weekdays,
.date-picker-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
}

.date-picker-weekdays span {
  color: #667085;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 0;
}

.date-picker-days button {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: #344054;
  height: 30px;
}

.date-picker-days button:hover {
  background: #eef3f8;
}

.date-picker-popover .sun {
  color: #d92d20;
}

.date-picker-popover .sat {
  color: #1f6feb;
}

.date-picker-days button.selected {
  background: #1f6feb;
  color: #fff;
  font-weight: 800;
}

.readonly-date {
  background: #e9ecef !important;
  cursor: not-allowed;
}

.table-wrap {
  overflow: hidden;
}

.pager {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: center;
  margin: 16px 0 0;
}

.pager-link {
  align-items: center;
  background: #fff;
  border: 1px solid #cfd8e3;
  border-radius: 6px;
  color: #344054;
  display: inline-flex;
  font-size: 13px;
  font-weight: 700;
  justify-content: center;
  min-height: 34px;
  min-width: 38px;
  padding: 6px 10px;
  text-decoration: none;
}

.pager-link:hover {
  background: #f8fafc;
  color: #1f6feb;
}

.pager-link.active {
  background: #1f6feb;
  border-color: #1f6feb;
  color: #fff;
}

.pager-link.disabled {
  color: #98a2b3;
  pointer-events: none;
}

.table {
  margin: 0;
}

.table thead th {
  background: #eef3f8;
  color: #465365;
  font-size: 13px;
  font-weight: 700;
}

.record-link {
  color: #1f6feb;
  font-weight: 700;
  text-decoration: none;
}

.record-link:hover {
  text-decoration: underline;
}

.status-pill {
  background: #edf7f2;
  border: 1px solid #cbe8d8;
  border-radius: 999px;
  color: #17643a;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
}

.muted-pill {
  background: #f2f4f7;
  border: 1px solid #d0d5dd;
  border-radius: 999px;
  color: #475467;
  display: inline-block;
  font-size: 12px;
  font-weight: 700;
  padding: 4px 10px;
}

.empty {
  color: #667085;
  padding: 36px !important;
  text-align: center;
}

.form-panel,
.detail-panel {
  padding: 22px;
}

.user-form {
  max-width: 860px;
}

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

.form-grid.compact {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}

.form-grid.compact > .mb-3:first-child {
  grid-column: span 2;
}

.form-actions {
  border-top: 1px solid #dde3ea;
  display: flex;
  gap: 8px;
  margin-top: 18px;
  padding-top: 18px;
}

.detail-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 22px;
}

.detail-grid.slim {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.detail-grid div {
  background: #f8fafc;
  border: 1px solid #e6ebf1;
  border-radius: 8px;
  padding: 12px;
}

.detail-grid dt,
.detail-panel h2 {
  color: #667085;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 5px;
}

.detail-grid dd {
  margin: 0;
}

.detail-panel section {
  border-top: 1px solid #e6ebf1;
  padding: 16px 0 0;
}

.pre-line {
  white-space: pre-line;
}

.editor-section {
  border-top: 1px solid #dde3ea;
  margin-top: 18px;
  padding-top: 18px;
}

.editor-section h2,
.detail-section h2 {
  color: #1d2733;
  font-size: 20px;
  font-weight: 800;
  margin: 0 0 14px;
}

.editor-grid,
.detail-editor-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.editor-grid .editor-field,
.detail-editor-grid > div {
  background: #fff;
  border: 1px solid #2f6fb3;
  border-radius: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
}

.editor-grid .editor-field + .editor-field,
.detail-editor-grid > div + div {
  background: #fff;
}

.editor-cell-grid,
.detail-cell-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
}

.detail-cell-grid {
  flex: 1 1 auto;
}

.editor-table-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
}

.editor-table-head label,
.editor-table-head h3 {
  background: #fff;
  border-bottom: 1px solid #2f6fb3;
  display: block;
  font-size: 15px;
  font-weight: 700;
  margin: 0;
  padding: 8px 10px;
}

.editor-table-head label + label,
.editor-table-head h3 + h3 {
  border-left: 1px solid #2f6fb3;
  text-align: center;
}

.editor-date-cell,
.detail-date-cell {
  background: #fff;
  border-left: 1px solid #2f6fb3;
  padding: 10px;
}

.editor-date-cell .form-control {
  font-size: 13px;
  padding-left: 6px;
  padding-right: 6px;
}

.detail-date-cell strong {
  display: block;
  font-size: 14px;
  text-align: center;
  white-space: pre-line;
}

.editor-field {
  min-width: 0;
}

.editor-content-cell textarea {
  background: #fff;
  border: 0;
  border-radius: 0;
  min-height: 180px;
  outline: none;
  overflow-wrap: anywhere;
  padding: 12px;
  resize: vertical;
  width: 100%;
}

.editor-grid .editor-field:nth-child(2) .editor-content-cell textarea {
  font-size: 14px;
}

.html-content img {
  border-radius: 6px;
  display: block;
  height: auto;
  margin: 8px 0;
  max-width: 100%;
}

.editor-content-cell textarea:focus {
  border-color: #1f6feb;
  box-shadow: 0 0 0 3px rgba(31, 111, 235, 0.14);
}

.detail-section {
  border-top: 1px solid #e6ebf1;
  padding-top: 18px;
}

.detail-section h3 {
  color: #465365;
  font-size: 15px;
  font-weight: 800;
  margin: 0;
}

.html-content {
  background: #fff;
  border: 0;
  border-radius: 0;
  min-height: 120px;
  overflow-wrap: anywhere;
  padding: 14px;
  white-space: pre-line;
}

.detail-editor-grid > div:nth-child(2) .html-content {
  min-height: 120px;
}

.html-content p:last-child {
  margin-bottom: 0;
}

.html-content blockquote {
  border-left: 4px solid #cfd8e3;
  color: #465365;
  margin: 8px 0;
  padding: 4px 0 4px 12px;
}

.html-content h3 {
  font-size: 18px;
  font-weight: 800;
  margin: 8px 0;
}

.login-body {
  align-items: center;
  display: flex;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.login-panel {
  max-width: 420px;
  padding: 30px;
  width: 100%;
}

.login-logo {
  display: block;
  height: auto;
  margin: 0 auto 18px;
  max-width: 100%;
  width: 320px;
}

.login-panel h1 {
  font-size: 30px;
  font-weight: 800;
  margin: 0;
  text-align: center;
}

@media (max-width: 768px) {
  .page-heading,
  .toolbar,
  .previous-panel {
    align-items: stretch;
    flex-direction: column;
  }

  .previous-panel {
    display: flex;
    max-width: none;
  }

  .metric-grid,
  .weekly-plan-grid,
  .form-grid,
  .form-grid.compact,
  .detail-grid,
  .detail-grid.slim {
    grid-template-columns: 1fr;
  }

  .editor-grid,
  .detail-editor-grid {
    grid-template-columns: 1fr;
  }

  .weekly-plan-item-head,
  .weekly-plan-row {
    grid-template-columns: minmax(0, 1fr) 96px;
  }

  .table-wrap {
    overflow-x: auto;
  }
}
