:root {
  --brand: #0e3a75;
  --brand2: #1769d2;
  --bg: #f4f7fb;
  --sidebar: #0c2e5d;
  --sidebar2: #0b2347;
  --text: #19253b;
  --muted: #718096;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family:
    Inter,
    system-ui,
    -apple-system,
    BlinkMacSystemFont,
    "Segoe UI",
    sans-serif;
  font-size: 0.94rem;
}

/* =========================
   SIDEBAR
========================= */

.app-sidebar {
  background: linear-gradient(180deg, var(--sidebar), var(--sidebar2));
  width: 254px;
  position: fixed;
  inset: 0 auto 0 0;
  color: #fff;
  z-index: 1050;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: 0.25s transform;
}

.brand {
  color: #fff;
  text-decoration: none;
  padding: 1.4rem 1.3rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand:hover {
  color: #fff;
}

.brand-mark,
.mobile-brand {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: linear-gradient(135deg, #ffbb45, #ff7c43);
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  box-shadow: 0 10px 22px rgba(255, 153, 0, 0.25);
}

.brand strong {
  display: block;
  letter-spacing: 0.06em;
  font-size: 1rem;
}

.brand small {
  display: block;
  color: #b6c9e8;
  font-size: 0.68rem;
  margin-top: 2px;
}

.sidebar-user {
  margin: 0.5rem 1rem 1rem;
  padding: 0.75rem;
  border: 1px solid rgba(255, 255, 255, 0.11);
  background: rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  display: flex;
  gap: 0.65rem;
  align-items: center;
}

.sidebar-user strong,
.sidebar-user small {
  display: block;
}

.sidebar-user small {
  color: #b6c9e8;
  font-size: 0.72rem;
}

.avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #ffbb45, #ff7c43);
  display: grid;
  place-items: center;
  color: #27344f;
  font-weight: 800;
  flex: 0 0 auto;
}

.avatar-sm {
  width: 32px;
  height: 32px;
  font-size: 0.75rem;
}

.sidebar-menu-title {
  padding: 0.65rem 1.3rem 0.35rem;
  color: #9eb8df;
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 0.09em;
  flex: 0 0 auto;
}

/* FIX MENU SIDEBAR:
   Wajib lurus ke bawah dan tidak boleh pindah ke samping */
.sidebar-nav {
  display: flex !important;
  flex-direction: column !important;
  flex-wrap: nowrap !important;
  align-items: stretch !important;

  padding: 0 0.75rem 1rem;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1 1 auto;
  width: 100%;
  min-width: 0;
}

.sidebar-nav .nav-link {
  width: 100%;
  min-width: 0;
  flex: 0 0 auto;

  color: #c3d4ee;
  border-radius: 9px;
  padding: 0.72rem 0.8rem;
  margin: 0.14rem 0;
  display: flex !important;
  align-items: center;
  gap: 0.78rem;
  font-size: 0.89rem;
  white-space: nowrap;
}

.sidebar-nav .nav-link i {
  font-size: 1.05rem;
  width: 1.15rem;
  flex: 0 0 1.15rem;
}

.sidebar-nav .nav-link:hover,
.sidebar-nav .nav-link.active {
  color: #fff;
  background: rgba(64, 136, 255, 0.29);
}

.sidebar-footer {
  flex: 0 0 auto;
  padding: 1rem 1.3rem;
  border-top: 1px solid rgba(255, 255, 255, 0.11);
}

.sidebar-footer a {
  color: #e8effc;
  text-decoration: none;
}

/* =========================
   MAIN LAYOUT
========================= */

.app-main {
  margin-left: 254px;
  min-height: 100vh;
}

.topbar {
  height: 76px;
  background: #fff;
  border-bottom: 1px solid #e7ecf4;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1.6rem;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-title h1 {
  font-size: 1.12rem;
  font-weight: 750;
  margin: 0;
}

.topbar-title span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  margin-top: 0.12rem;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.page-content {
  padding: 1.5rem;
  max-width: 1800px;
  margin: auto;
}

/* =========================
   PANEL DAN DASHBOARD
========================= */

.panel {
  background: #fff;
  border: 1px solid #e6edf6;
  border-radius: 15px;
  padding: 1.1rem;
  box-shadow: 0 3px 14px rgba(24, 44, 81, 0.035);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.panel-header h5 {
  font-size: 1rem;
  font-weight: 750;
  margin: 0;
}

.panel-header p {
  font-size: 0.79rem;
  color: var(--muted);
  margin: 0.25rem 0 0;
}

.metric-card {
  background: #fff;
  border: 1px solid #e6edf6;
  border-radius: 15px;
  padding: 1.1rem;
  min-height: 125px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  box-shadow: 0 3px 14px rgba(24, 44, 81, 0.035);
}

.metric-card span {
  font-size: 0.78rem;
  color: var(--muted);
  display: block;
}

.metric-card h3 {
  font-size: 1.25rem;
  font-weight: 800;
  margin: 0.45rem 0;
}

.metric-card small {
  font-size: 0.72rem;
}

.metric-icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-size: 1.2rem;
}

.metric-icon.primary {
  background: #e7f0ff;
  color: #0d6efd;
}

.metric-icon.success {
  background: #e8f8ee;
  color: #198754;
}

.metric-icon.warning {
  background: #fff3dd;
  color: #d98e00;
}

.metric-icon.danger {
  background: #ffeaea;
  color: #dc3545;
}

.chart-wrap {
  height: 245px;
}

.kitchen-number {
  font-size: 3.4rem;
  font-weight: 800;
  line-height: 1;
  color: #e59b00;
}

.top-menu-list {
  list-style: none;
  padding: 0;
  margin: 0;
  counter-reset: item;
}

.top-menu-list li {
  display: flex;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid #edf1f6;
}

.top-menu-list li:last-child {
  border: none;
}

.top-menu-list li span:before {
  content: counter(item);
  counter-increment: item;
  background: #e7f0ff;
  color: #0d6efd;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.18rem 0.43rem;
  border-radius: 50%;
  margin-right: 0.55rem;
}

.top-menu-list li strong {
  font-size: 0.82rem;
}

.thumb {
  height: 40px;
  width: 52px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid #e3e9f2;
}

/* =========================
   TABLE
========================= */

.table > thead > tr > th {
  color: #59667a;
  font-size: 0.73rem;
  text-transform: uppercase;
  letter-spacing: 0.035em;
  border-bottom-color: #e6edf6;
  background: #fafcff;
}

.table > tbody > tr > td {
  font-size: 0.85rem;
  border-bottom-color: #edf1f6;
}

.table tbody tr:last-child td {
  border-bottom: none;
}

.table-responsive {
  border-radius: 0.5rem;
}

/* =========================
   STOK
========================= */

.low-stock-list > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 0;
  border-bottom: 1px solid #edf1f6;
}

.low-stock-list > div:last-child {
  border-bottom: 0;
}

.low-stock-list small {
  display: block;
  color: var(--muted);
  font-size: 0.73rem;
}

.low-stock-list b {
  color: #dc3545;
}

/* =========================
   KASIR POS
========================= */

.pos-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 1rem;
  min-height: calc(100vh - 125px);
}

.pos-menu-area,
.pos-cart {
  background: #fff;
  border: 1px solid #e6edf6;
  border-radius: 15px;
}

.pos-menu-area {
  padding: 1rem;
}

.pos-toolbar {
  display: flex;
  gap: 0.8rem;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.pos-toolbar .input-group {
  max-width: 340px;
}

.category-scroll {
  display: flex;
  gap: 0.45rem;
  overflow: auto;
  padding-bottom: 2px;
}

.category-scroll .btn {
  white-space: nowrap;
  border-radius: 20px;
  font-size: 0.8rem;
}

.menu-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 0.85rem;
}

.menu-card {
  background: #fff;
  border: 1px solid #e2e9f1;
  border-radius: 13px;
  padding: 0;
  text-align: left;
  overflow: hidden;
  transition: 0.16s;
  cursor: pointer;
}

.menu-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(17, 57, 114, 0.12);
  border-color: #88b5f3;
}

.menu-card img {
  width: 100%;
  aspect-ratio: 1.5/1;
  object-fit: cover;
  background: #eef4fe;
}

.menu-card-body {
  display: flex;
  flex-direction: column;
  padding: 0.65rem;
}

.menu-card-body small {
  color: var(--muted);
  font-size: 0.67rem;
}

.menu-card-body strong {
  font-size: 0.84rem;
  line-height: 1.25;
  margin: 0.22rem 0;
  min-height: 2.1em;
}

.menu-card-body b {
  font-size: 0.82rem;
  color: #0d6efd;
}

.pos-cart {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.cart-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid #edf1f6;
  padding-bottom: 0.75rem;
}

.cart-heading h4 {
  font-size: 1rem;
  margin: 0;
}

.cart-heading span {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
}

.cart-items {
  overflow: auto;
  flex: 1;
  min-height: 180px;
  padding: 0.7rem 0;
}

.empty-cart {
  text-align: center;
  color: #9aa7b9;
  padding: 2rem 0;
}

.empty-cart i {
  font-size: 2rem;
}

.cart-row {
  display: flex;
  gap: 0.65rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid #edf1f6;
}

.cart-row-info {
  flex: 1;
}

.cart-row-info strong {
  display: block;
  font-size: 0.85rem;
}

.cart-row-info small {
  color: var(--muted);
}

.qty-control {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  margin-top: 0.4rem;
}

.qty-control button {
  border: 1px solid #dce5f0;
  background: #fff;
  border-radius: 6px;
  width: 23px;
  height: 23px;
  line-height: 1;
}

.cart-row-price {
  text-align: right;
  font-weight: 700;
  font-size: 0.82rem;
  white-space: nowrap;
}

.order-meta {
  border-bottom: 1px solid #edf1f6;
  padding: 1rem 0;
}

.order-meta .form-label,
.pos-cart .form-label {
  font-size: 0.72rem;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.cart-summary {
  border-top: 1px solid #edf1f6;
  padding-top: 0.75rem;
}

.cart-summary > div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0.45rem 0;
  font-size: 0.84rem;
}

.cart-summary input {
  width: 120px;
}

.cart-total {
  font-size: 1rem !important;
  border-top: 1px dashed #cfd8e4;
  padding-top: 0.7rem;
}

.cart-total strong {
  font-size: 1.18rem;
  color: #0d6efd;
}

.cart-summary button {
  margin-top: 0.55rem;
}

.payment-total {
  background: #f2f7ff;
  padding: 1rem;
  border-radius: 12px;
}

.payment-total small {
  color: var(--muted);
}

.payment-total h2 {
  margin: 0;
  color: #0d6efd;
  font-weight: 800;
}

.payment-methods {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.55rem;
}

.payment-method {
  background: #fff;
  border: 1px solid #dce5f0;
  border-radius: 10px;
  padding: 0.6rem 0.25rem;
  font-size: 0.75rem;
}

.payment-method i {
  display: block;
  font-size: 1.1rem;
  margin-bottom: 0.2rem;
}

.payment-method.active {
  border-color: #0d6efd;
  background: #edf5ff;
  color: #0d6efd;
}

.change-box {
  background: #effaf3;
  border-radius: 10px;
  padding: 0.75rem;
  display: flex;
  justify-content: space-between;
}

/* =========================
   KITCHEN
========================= */

.kitchen-topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
  margin-bottom: 1rem;
}

.kitchen-board {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(275px, 1fr));
  gap: 1rem;
}

.kitchen-ticket {
  background: #fff;
  border: 1px solid #e6edf6;
  border-radius: 14px;
  padding: 1rem;
  border-top: 4px solid #6c757d;
  box-shadow: 0 3px 14px rgba(24, 44, 81, 0.035);
}

.kitchen-ticket.status-processing {
  border-top-color: #e0a800;
}

.kitchen-ticket.status-ready {
  border-top-color: #0dcaf0;
}

.ticket-head {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
}

.ticket-invoice {
  display: block;
  font-weight: 800;
}

.ticket-head small {
  color: var(--muted);
}

.kitchen-ticket ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0;
}

.kitchen-ticket li {
  padding: 0.36rem 0;
  border-bottom: 1px dashed #e5ebf3;
}

.kitchen-ticket li:last-child {
  border: 0;
}

.kitchen-ticket li strong {
  color: #0d6efd;
  margin-right: 0.4rem;
}

.ticket-note {
  background: #fff7df;
  padding: 0.5rem;
  border-radius: 8px;
  font-size: 0.8rem;
}

/* =========================
   RESEP
========================= */

.recipe-card {
  background: #fff;
  border: 1px solid #e6edf6;
  border-radius: 14px;
  padding: 1rem;
  height: 100%;
}

.recipe-card-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.recipe-card-head h5 {
  font-weight: 750;
  font-size: 1rem;
  margin: 0.5rem 0 0.1rem;
}

.recipe-card-head small {
  color: var(--muted);
}

.recipe-card-head > i {
  font-size: 1.5rem;
  color: #0d6efd;
}

.recipe-card ul {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

.recipe-card li {
  display: flex;
  justify-content: space-between;
  border-bottom: 1px solid #edf1f6;
  padding: 0.5rem 0;
  font-size: 0.83rem;
}

.recipe-card li:last-child {
  border: 0;
}

/* =========================
   LOGIN
========================= */

.login-body {
  min-height: 100vh;
  background: #f4f7fb;
}

.login-wrap {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.05fr 0.95fr;
}

.login-hero {
  background: linear-gradient(135deg, #082b5b, #0e4f9d);
  color: #fff;
  padding: 12%;
  align-items: center;
}

.login-hero h1 {
  font-size: 3rem;
  letter-spacing: 0.06em;
  font-weight: 850;
  margin: 1rem 0 0;
}

.login-hero p {
  font-size: 1.1rem;
}

.hero-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  font-size: 2rem;
  background: linear-gradient(135deg, #ffbb45, #ff7c43);
}

.login-panel {
  display: grid;
  place-items: center;
  padding: 2rem;
}

.login-card {
  width: min(420px, 100%);
}

.login-card h3 {
  font-weight: 800;
}

.demo-note {
  background: #f4f8ff;
  border-left: 4px solid #0d6efd;
  padding: 0.8rem;
  border-radius: 8px;
  font-size: 0.82rem;
}

.mobile-brand {
  margin: auto;
}

.empty-state {
  grid-column: 1/-1;
  text-align: center;
  background: #fff;
  border: 1px dashed #cbd7e5;
  border-radius: 15px;
  padding: 3rem;
  color: #8492a6;
}

.empty-state i {
  font-size: 2.7rem;
  color: #198754;
}

/* =========================
   CRUD, REPORT, DETAIL
========================= */

.detail-menu-image {
  width: 135px;
  height: 96px;
  object-fit: cover;
  border: 1px solid #e3e9f2;
  border-radius: 12px;
  background: #f6f9fc;
}

.quick-menu-vertical {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.quick-menu-vertical a {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: #28476f;
  border: 1px solid #e6edf6;
  border-radius: 10px;
  padding: 0.72rem 0.75rem;
  background: #fff;
}

.quick-menu-vertical a:hover {
  border-color: #8db7f6;
  background: #f2f7ff;
  color: #0d6efd;
}

.quick-menu-vertical a > i:first-child {
  width: 25px;
  color: #0d6efd;
  font-size: 1rem;
}

.report-tabs {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.report-tabs .btn {
  font-size: 0.82rem;
}

.audit-json {
  display: block;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 120px;
  overflow: auto;
  font-size: 0.7rem;
}

.btn-group form {
  display: inline;
}

.btn-group {
  align-items: stretch;
}

.btn-group form .btn {
  border-radius: 0;
}

.btn-group form:last-child .btn {
  border-radius: 0 0.25rem 0.25rem 0;
}

.form-label {
  font-weight: 600;
  font-size: 0.8rem;
}

.recipe-line .form-label,
.purchase-line .form-label {
  font-size: 0.72rem;
}

.opacity-50 {
  opacity: 0.55 !important;
}

.sidebar-backdrop {
  display: none;
}

/* =========================
   TABLET / MOBILE
========================= */

@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
  }

  .app-sidebar.open {
    transform: translateX(0);
  }

  .sidebar-backdrop.show {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(10, 26, 51, 0.45);
    z-index: 1040;
  }

  .app-main {
    margin-left: 0;
  }

  .topbar {
    padding: 0 1rem;
  }

  .page-content {
    padding: 1rem;
  }

  .pos-layout {
    grid-template-columns: 1fr;
  }

  .pos-cart {
    min-height: 500px;
  }

  .login-wrap {
    grid-template-columns: 1fr;
  }

  .login-panel {
    padding: 1.5rem;
  }

  .menu-grid {
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
  }
}

@media (max-width: 575.98px) {
  .topbar-title h1 {
    font-size: 1rem;
  }

  .page-content {
    padding: 0.75rem;
  }

  .metric-card {
    padding: 0.85rem;
    min-height: 105px;
  }

  .metric-card h3 {
    font-size: 1rem;
  }

  .metric-icon {
    width: 34px;
    height: 34px;
  }

  .panel {
    padding: 0.85rem;
    border-radius: 12px;
  }

  .menu-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.6rem;
  }

  .pos-menu-area,
  .pos-cart {
    border-radius: 12px;
    padding: 0.75rem;
  }

  .pos-toolbar .input-group {
    max-width: none;
  }

  .menu-card-body {
    padding: 0.5rem;
  }

  .menu-card-body strong {
    font-size: 0.78rem;
  }

  .kitchen-board {
    grid-template-columns: 1fr;
  }

  .payment-methods {
    grid-template-columns: repeat(2, 1fr);
  }

  .table {
    min-width: 620px;
  }

  .pos-cart {
    min-height: 420px;
  }

  .topbar-actions span {
    display: none;
  }

  .detail-menu-image {
    width: 100px;
    height: 75px;
  }

  .report-tabs {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .report-tabs .btn {
    font-size: 0.75rem;
  }

  .quick-menu-vertical a {
    padding: 0.65rem;
  }

  .btn-group {
    white-space: nowrap;
  }

  .sidebar-nav {
    padding-bottom: 4rem;
  }
}
