@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans:wght@400;500;600;700&display=swap');

:root {
  --primary-blue: #0d6efd;
  --primary-blue-hover: #0b5ed7;
  --primary-blue-dark: #0a58ca;
  --accent-blue: #6ea8fe;
  --success-green: #198754;
  --warning-yellow: #ff8c00;
  --danger-red: #dc3545;
  --gray-50: #f8f9fa;
  --gray-100: #e9ecef;
  --gray-200: #dee2e6;
  --gray-300: #ced4da;
  --gray-400: #adb5bd;
  --gray-500: #6c757d;
  --gray-700: #343a40;
  --gray-900: #0d1117;
  --panel: #ffffff;
  --border: #dee2e6;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "IBM Plex Sans", "Segoe UI", sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
}

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

.sidebar {
  background: var(--gray-900);
  color: #fff;
  padding: 24px 18px;
}

.brand {
  margin-bottom: 24px;
}

.brand-title {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: 0.4px;
}

.brand-subtitle {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.65);
}

.sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.sidebar nav a {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.06);
}

.sidebar nav a.active {
  background: var(--primary-blue);
  color: #fff;
}

.content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: #ffffff;
  border-bottom: 1px solid var(--border);
}

.icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: var(--gray-500);
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.sidebar nav a.active .icon svg,
.sidebar nav a:hover .icon svg {
  stroke: var(--primary);
}

.panel h2 .icon {
  margin-right: 8px;
  display: inline-flex;
  vertical-align: middle;
}

.topbar-title {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar-meta {
  color: var(--gray-500);
  font-size: 13px;
}

main {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 24px;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px;
  margin-bottom: 20px;
  box-shadow: 0 6px 18px rgba(13, 17, 23, 0.06);
}

h2 {
  margin-top: 0;
  font-size: 20px;
}

.page-note {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 12px;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--gray-700);
}

form {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

label {
  display: block;
  font-size: 13px;
  color: var(--gray-500);
  margin-bottom: 4px;
}

input,
select,
textarea {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
}

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

.actions {
  grid-column: 1 / -1;
  display: flex;
  gap: 10px;
  align-items: center;
}

button,
.button-link {
  padding: 8px 14px;
  border: none;
  border-radius: 6px;
  background: var(--primary-blue);
  color: #fff;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
}

button:hover,
.button-link:hover {
  background: var(--primary-blue-hover);
}

.button-link.secondary,
button.secondary {
  background: var(--gray-200);
  color: var(--gray-700);
}

.button-link.danger,
button.danger {
  background: #d92d20;
  color: #fff;
}

.button-link.success,
button.success {
  background: #16a34a;
  color: #fff;
}

.table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.table tr[data-edit-url] {
  cursor: pointer;
}

.table tr[data-edit-url]:hover {
  background: #f2f5fb;
}

.calendar-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.calendar-title {
  font-weight: 700;
  color: var(--gray-700);
}

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

.calendar-header {
  font-size: 12px;
  color: var(--gray-500);
  text-align: center;
  padding: 6px 0;
}

.calendar-day {
  min-height: 90px;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px;
  background: #fff;
}

.calendar-day[data-edit-url] {
  cursor: pointer;
}

.calendar-day.empty {
  background: #f8fafc;
  border-color: transparent;
}

.calendar-day.today {
  border-color: var(--primary);
  box-shadow: 0 0 0 1px rgba(28, 72, 122, 0.2);
}

.calendar-date {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-600);
  margin-bottom: 4px;
}

.calendar-items {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-items a {
  font-size: 12px;
  color: var(--gray-700);
  text-decoration: none;
}

.calendar-items a:hover {
  color: var(--primary);
}

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

.table th {
  background: var(--gray-100);
  font-weight: 600;
}

.table tr:hover td {
  background: #f3f7fb;
}

.table tr[data-edit-url] {
  cursor: pointer;
}

.table tr.row-danger td {
  color: #b42318;
}

.table tr.row-danger td {
  background: #fdecec;
}

.table tr.row-info td {
  color: #1d4ed8;
}

.table tr.row-info td {
  background: #e6f0ff;
}

.table tr.row-success td {
  color: #15803d;
}

.table tr.row-success td {
  background: #e8f7ef;
}

.table tr.row-warning td {
  color: #a16207;
  background: #fff7e6;
}

.table tr.row-orange td {
  color: #c2410c;
  background: #ffedd5;
}

.ocr-panel {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  background: #f8fafc;
}

.ocr-hint {
  font-size: 12px;
  color: var(--gray-600);
}

.ocr-modal {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 24px;
}

.ocr-modal.open {
  display: flex;
}

.ocr-modal-content {
  background: #fff;
  width: min(860px, 100%);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 20px 60px rgba(15, 23, 42, 0.35);
}

.ocr-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.ocr-close {
  border: none;
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.ocr-body {
  display: grid;
  gap: 12px;
}

.ocr-camera {
  display: grid;
  gap: 8px;
}

#ocr-video,
#ocr-canvas {
  width: 100%;
  max-height: 320px;
  background: #0f172a;
  border-radius: 10px;
  object-fit: cover;
}

.ocr-canvas {
  display: none;
}

.ocr-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.ocr-status {
  font-size: 13px;
  color: var(--gray-600);
}

#ocr-text {
  min-height: 140px;
}

#ocr-file {
  display: none;
}

.badge {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
  background: var(--gray-200);
  color: var(--gray-700);
}

.badge.success {
  background: #d1e7dd;
  color: var(--success-green);
}

.badge.warn {
  background: #fff3cd;
  color: var(--warning-yellow);
}

.badge.info {
  background: #e0f2fe;
  color: #0284c7;
}

.notice {
  padding: 10px 12px;
  border-radius: 6px;
  background: #fff3cd;
  border: 1px solid #ffeeba;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
}

.menu-card {
  display: block;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
  background: #ffffff;
  box-shadow: 0 6px 16px rgba(13, 17, 23, 0.08);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.menu-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 22px rgba(13, 17, 23, 0.12);
}

.menu-card h3 {
  margin: 0 0 6px;
  font-size: 16px;
}

.menu-card span {
  display: inline-block;
  font-size: 13px;
  color: var(--gray-500);
}

.menu-card-icon {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  background: var(--gray-100);
  margin-bottom: 6px;
}

.menu-card-icon .icon svg {
  width: 18px;
  height: 18px;
  stroke: var(--gray-700);
}

.table-filter thead .filter-row th {
  padding: 6px 8px;
}

.table-filter thead .filter-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  font-size: 12px;
  background: #fff;
}

.table-filter thead th.sortable {
  cursor: pointer;
}

.table-filter thead th.sortable:hover {
  color: var(--primary);
}

.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.bulk-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bulk-form select {
  width: auto;
  min-width: 180px;
}

.table-filter thead th.sort-asc::after,
.table-filter thead th.sort-desc::after {
  display: inline-block;
  margin-left: 6px;
  font-size: 10px;
  color: var(--gray-400);
}

.table-filter thead th.sort-asc::after {
  content: "▲";
}

.table-filter thead th.sort-desc::after {
  content: "▼";
}

.footer-search {
  padding: 18px 24px 24px;
  border-top: 1px solid var(--border);
  background: #ffffff;
}

.footer-search form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  max-width: 720px;
  margin: 0 auto;
}

.footer-search input {
  border-radius: 999px;
  padding: 10px 14px;
}

.footer-search button {
  border-radius: 999px;
  padding: 10px 18px;
}

@media (max-width: 720px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: sticky;
    top: 0;
    z-index: 10;
  }

  .actions {
    flex-direction: column;
    align-items: stretch;
  }
}
