* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: #f5f6f8;
  color: #1f2933;
}

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

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px;
}

.topbar {
  background: #0f172a;
  color: #f8fafc;
}

.topbar-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

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

.brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  background: #fff;
  border-radius: 12px;
  padding: 6px;
}

.subtitle {
  margin: 4px 0 0;
  font-size: 14px;
  color: #cbd5f5;
}

.nav {
  display: flex;
  gap: 16px;
  font-weight: 600;
}

.nav a {
  padding: 8px 12px;
  border-radius: 8px;
  transition: background 0.2s;
}

.nav a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.nav form {
  margin: 0;
}

.nav .btn {
  color: #f8fafc;
  border-color: rgba(248, 250, 252, 0.4);
}

.nav .btn:hover {
  background: rgba(255, 255, 255, 0.12);
}

.card {
  background: #ffffff;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 16px;
}

h1,
h2,
h3 {
  margin: 0;
}

.grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  align-items: end;
}

.full {
  grid-column: 1 / -1;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-weight: 600;
  color: #334155;
}

.help {
  font-size: 12px;
  color: #64748b;
  font-weight: 500;
}

input,
select,
textarea {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #cbd5e1;
  font-size: 14px;
  background: #fff;
}

.rtl-input {
  text-align: right;
  direction: rtl;
}

.inline-field {
  display: inline-flex;
  flex-direction: column;
  gap: 8px;
  max-width: 280px;
  margin-bottom: 16px;
}

.section-grid {
  display: grid;
  gap: 20px;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
}

.section-card {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  background: #f8fafc;
  overflow: hidden;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.section-controls {
  display: flex;
  gap: 8px;
  align-items: stretch;
  flex-direction: column;
}

.section-controls .dish-search {
  width: 100%;
}

.section-controls .dish-select {
  width: 100%;
}

.section-controls .btn {
  align-self: flex-start;
}

.section-controls .inline-toggle {
  align-self: flex-start;
}

.inline-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #64748b;
}

.inline-toggle input {
  margin: 0;
}

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

.dish-item {
  background: #ffffff;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.dish-actions {
  display: flex;
  gap: 6px;
}

.btn {
  border: none;
  padding: 10px 16px;
  border-radius: 10px;
  background: #e2e8f0;
  color: #0f172a;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.btn:hover {
  background: #cbd5e1;
}

.btn.primary {
  background: #2563eb;
  color: #fff;
}

.btn.primary:hover {
  background: #1d4ed8;
}

.btn.ghost {
  background: transparent;
  border: 1px solid #cbd5e1;
}

.btn.icon {
  padding: 6px 8px;
  font-size: 14px;
}

.form-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-top: 12px;
}

.button-group {
  display: flex;
  gap: 8px;
}

.muted {
  color: #64748b;
}

.hint {
  margin-top: 8px;
  color: #64748b;
  font-size: 13px;
}

.badge {
  padding: 6px 12px;
  background: #dbeafe;
  color: #1d4ed8;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}

.badge.neutral {
  background: #e2e8f0;
  color: #475569;
}

.alert {
  padding: 12px 16px;
  border-radius: 10px;
  margin-bottom: 16px;
}

.alert.success {
  background: #dcfce7;
  color: #166534;
}

.alert.error {
  background: #fee2e2;
  color: #b91c1c;
}

.table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 12px;
}

.table th,
.table td {
  padding: 12px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
}

.table th[data-sort] {
  cursor: pointer;
}

.table th[data-sort]::after {
  content: "↕";
  font-size: 12px;
  margin-left: 6px;
  color: #94a3b8;
}

.table th.sorted-asc::after {
  content: "↑";
  color: #2563eb;
}

.table th.sorted-desc::after {
  content: "↓";
  color: #2563eb;
}

.rtl {
  text-align: right;
  direction: rtl;
}

.lang-missing {
  color: #dc2626;
  font-weight: 700;
  margin-left: 4px;
}

.origin-label {
  color: #2563eb;
  font-size: 12px;
  margin-left: 6px;
  font-weight: 600;
}

.ltr {
  text-align: left;
  direction: ltr;
}

.link {
  margin-right: 12px;
  color: #2563eb;
  font-weight: 600;
}

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

.menu-preview.menu-sheet {
  display: block;
  text-align: center;
}

.menu-title {
  font-family: "Georgia", "Times New Roman", serif;
  font-size: 16px;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin: 6px 0 0;
}

.menu-sheet {
  background: #f8f5ef;
  border: 1px solid #e7e2d7;
  padding: 24px;
  border-radius: 18px;
}

.preview-header {
  display: flex;
  align-items: center;
  gap: 12px;
}

.preview-logo {
  width: 56px;
  height: 56px;
  object-fit: contain;
  border-radius: 10px;
  background: #fff;
  padding: 6px;
  border: 1px solid #e2e8f0;
}

.menu-section {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 16px;
  background: #f8fafc;
}

.menu-preview.menu-sheet .menu-section {
  margin: 18px 0;
}

.menu-sheet .menu-section {
  background: transparent;
  border: none;
  padding: 12px 0;
}

.menu-sheet .menu-section h3,
.menu-sheet .print-section h2 {
  font-family: "Georgia", "Times New Roman", serif;
  text-transform: uppercase;
  letter-spacing: 2px;
  color: #1f2933;
}

.menu-sheet ul {
  font-family: "Georgia", "Times New Roman", serif;
  color: #1f2933;
}

.menu-section ul {
  padding-left: 18px;
  margin: 12px 0 0;
}

.menu-preview.menu-sheet ul,
.print-sections ul {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
}

.menu-preview.menu-sheet li,
.print-sections li {
  margin: 6px 0;
  font-style: italic;
}
.menu-meta {
  margin-top: 16px;
  display: flex;
  gap: 24px;
  color: #64748b;
}

.footer {
  background: #0f172a;
  color: #cbd5e1;
  padding: 16px 0;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
}

.login-body {
  background: #0f172a;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.login-card {
  background: #ffffff;
  padding: 32px;
  border-radius: 16px;
  width: 100%;
  max-width: 360px;
  text-align: center;
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.2);
}

.login-logo {
  width: 72px;
  height: 72px;
  object-fit: contain;
  margin: 0 auto 12px;
}

.login-form {
  display: grid;
  gap: 12px;
  margin-top: 16px;
  text-align: left;
}

.login-form label {
  font-weight: 600;
  color: #1f2933;
  gap: 6px;
}

.login-form .btn {
  width: 100%;
  justify-content: center;
  margin-top: 8px;
}

.print-body {
  background: #fff;
  color: #111827;
  padding: 32px;
}

.print-logo {
  width: 90px;
  height: 90px;
  object-fit: contain;
  margin: 0 auto 12px;
  display: block;
}

.menu-hero {
  text-align: center;
  margin-bottom: 24px;
  font-family: "Georgia", "Times New Roman", serif;
}

.menu-hero h1 {
  margin: 6px 0 4px;
  letter-spacing: 2px;
}

.print-meta {
  display: flex;
  justify-content: center;
  gap: 24px;
  color: #475569;
  font-weight: 600;
}

.print-sections {
  display: block;
  text-align: center;
}

.print-section {
  padding: 8px 0;
  margin: 8px 0;
}

.print-section ul {
  list-style: none;
  padding: 0;
  margin: 10px 0 0;
}

.print-section li {
  margin: 6px 0;
  font-style: italic;
  text-align: center;
}

.print-footer {
  margin-top: 24px;
  display: flex;
  justify-content: space-between;
  color: #64748b;
}

.print-actions {
  margin-top: 24px;
  display: flex;
  gap: 12px;
}

.saved-menu-card {
  overflow: hidden;
}

.saved-menu-sheet {
  max-width: 850px;
  margin: 0 auto;
  padding: 48px 56px;
  border: 1px solid #ded7c8;
  box-shadow: 0 18px 45px rgba(43, 35, 22, 0.12);
}

.saved-menu-hero {
  text-align: center;
  padding-bottom: 24px;
  border-bottom: 1px solid #d8cfbd;
}

.saved-menu-hero h1 {
  font-family: "Georgia", "Times New Roman", serif;
  margin: 8px 0;
  letter-spacing: 1px;
}

.saved-menu-sheet .print-sections {
  margin-top: 22px;
}

.saved-menu-sheet .print-section h2 {
  font-size: 18px;
}

.saved-menu-sheet .print-section li {
  font-size: 16px;
  line-height: 1.65;
}

.table-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid #e2e8f0;
}

.month-group {
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  margin: 16px 0;
  background: #f8fafc;
}

.month-toggle {
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 16px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.month-remark {
  font-weight: 500;
  color: #2563eb;
}

.month-tools {
  padding: 0 16px 12px;
}

.remark-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.remark-form input {
  flex: 1 1 280px;
}

.month-panel {
  padding: 0 16px 16px;
}

.table-tools input {
  max-width: 260px;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 16px 0;
}

.tab-button {
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  padding: 8px 14px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
}

.tab-button.active {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
}

.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

@media print {
  .topbar,
  .footer,
  .no-print {
    display: none !important;
  }

  body {
    background: #fff;
  }

  .print-body {
    padding: 12px;
    font-size: 12px;
  }

  .menu-hero h1 {
    font-size: 22px;
  }

  .menu-title {
    font-size: 12px;
  }

  .container {
    max-width: none;
    padding: 0;
  }

  #viewPage,
  .saved-menu-card {
    display: block !important;
    box-shadow: none;
    padding: 0;
    margin: 0;
  }

  .saved-menu-sheet {
    max-width: none;
    border: 0;
    box-shadow: none;
    padding: 18px;
  }
}
