:root {
  --ink: #173225;
  --muted: #607064;
  --line: #d6e6da;
  --paper: #ffffff;
  --surface: #ffffff;
  --soft: #edf8f1;
  --brand: #009846;
  --brand-dark: #007a38;
  --gold: #c7a457;
  --green: #009846;
  --blue: #087f5b;
  --orange: #c7a457;
  --shadow: 0 18px 50px rgba(0, 152, 70, .12);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  background: var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  color: #fff;
  background: var(--ink);
  cursor: pointer;
}

button:hover {
  filter: brightness(.96);
}

button:disabled {
  opacity: .45;
  cursor: not-allowed;
}

.ghost {
  color: var(--ink);
  background: var(--soft);
}

.danger {
  background: var(--brand-dark);
}

.ok {
  background: var(--green);
}

.blue {
  background: var(--blue);
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 9px 10px;
  color: var(--ink);
  background: #fff;
}

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

.login-shell {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 20px;
}

.login {
  width: min(420px, 100%);
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 22px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: 6px;
  color: #fff;
  background: var(--brand);
  font-weight: 800;
}

.brand-logo {
  width: 52px;
  height: 52px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand h1 {
  margin: 0;
  font-size: 24px;
  letter-spacing: 0;
}

.brand p,
.hint,
.empty,
.meta {
  color: var(--muted);
}

.brand p {
  margin: 3px 0 0;
}

.field {
  display: grid;
  gap: 7px;
  margin: 12px 0;
}

.error {
  margin-top: 12px;
  color: var(--brand);
  font-weight: 700;
}

.app {
  min-height: 100vh;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 20px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .94);
  backdrop-filter: blur(12px);
}

.topbar .brand {
  margin: 0;
}

.userbox {
  display: flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}

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

.sidebar {
  border-right: 1px solid var(--line);
  padding: 18px 12px;
  background: #f5fbf7;
}

.navbtn {
  justify-content: flex-start;
  width: 100%;
  margin-bottom: 8px;
  color: var(--ink);
  background: transparent;
  text-align: left;
}

.navbtn.active {
  color: #fff;
  background: var(--brand);
}

.content {
  padding: 22px;
}

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-head h2 {
  margin: 0 0 5px;
  font-size: 25px;
}

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

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

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

.panel,
.card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.panel {
  padding: 16px;
}

.card {
  padding: 14px;
}

.card h3,
.panel h3 {
  margin: 0 0 10px;
  font-size: 18px;
}

.stat {
  border-left: 5px solid var(--brand);
}

.stat strong {
  display: block;
  font-size: 30px;
}

.table-map {
  position: relative;
  min-height: 560px;
  border: 1px dashed #c9beb3;
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(0,152,70,.08) 1px, transparent 1px),
    linear-gradient(rgba(0,152,70,.08) 1px, transparent 1px),
    #fff;
  background-size: 28px 28px;
  overflow: hidden;
}

.table-map-scroll {
  width: 100%;
  max-width: 100%;
  overflow: auto;
  padding: 0 0 8px;
}

.floor-table-wrap {
  position: absolute;
  display: grid;
  place-items: center;
  touch-action: none;
  user-select: none;
}

.floor-table {
  position: relative;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 100%;
  min-height: inherit;
  border: 2px solid var(--ink);
  border-radius: 8px;
  padding: 8px;
  background: #fff;
  box-shadow: 0 10px 24px rgba(35,36,37,.1);
  text-align: center;
  overflow: hidden;
}

.table-img {
  position: absolute;
  inset: 6px;
  width: calc(100% - 12px);
  height: calc(100% - 12px);
  object-fit: contain;
  opacity: .16;
  pointer-events: none;
}

.floor-table strong,
.floor-table small {
  position: relative;
  z-index: 2;
}

.floor-table.busy {
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(0, 152, 70, .18), 0 10px 24px rgba(35,36,37,.1);
}

.floor-table-wrap.dragging .floor-table {
  z-index: 3;
  border-color: var(--gold);
  box-shadow: 0 16px 36px rgba(35,36,37,.22);
}

.chair {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 24px;
  height: 24px;
  transform:
    rotate(var(--angle))
    translateX(var(--chair-radius))
    rotate(calc(-1 * var(--angle)));
  transform-origin: center;
  z-index: 1;
}

.chair img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

.floor-table small {
  display: block;
  color: var(--muted);
}

.list {
  display: grid;
  gap: 10px;
}

.row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.row:last-child {
  border-bottom: 0;
}

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

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 27px;
  border-radius: 999px;
  padding: 0 9px;
  color: #fff;
  background: var(--ink);
  font-size: 13px;
}

.pill.bar {
  background: var(--gold);
}

.pill.bar1 {
  background: var(--gold);
}

.pill.bar2 {
  background: #a9883e;
}

.pill.kitchen {
  background: var(--brand);
}

.pill.ready {
  background: var(--green);
}

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

.menu-item {
  min-height: 118px;
  color: var(--ink);
  background: #fff;
  border: 1px solid var(--line);
  text-align: left;
}

.menu-item strong {
  display: block;
  margin-bottom: 8px;
}

.cart-line {
  display: grid;
  grid-template-columns: 1fr 92px 36px;
  gap: 8px;
  align-items: center;
}

.cart-line-bar {
  grid-template-columns: 1fr 92px 36px;
}

.compact {
  margin: 0;
}

.order-card {
  display: grid;
  gap: 12px;
}

.order-title {
  display: flex;
  justify-content: space-between;
  gap: 10px;
}

.split {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) minmax(300px, 430px);
  gap: 16px;
  align-items: start;
}

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

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

.receipt {
  max-width: 360px;
}

.full {
  width: 100%;
  margin-top: 12px;
}

.spaced {
  margin-top: 14px;
}

.spaced-bottom {
  margin-bottom: 14px;
}

.spaced-title {
  margin-top: 18px !important;
}

.check-list {
  display: grid;
  gap: 8px;
}

.staff-line {
  display: grid;
  gap: 6px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.staff-line:last-child {
  border-bottom: 0;
}

.check-list label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.check-list input[type="checkbox"] {
  width: auto;
  min-height: auto;
}

.check-list select[multiple] {
  min-height: 86px;
  margin: 0 0 4px 24px;
}

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

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

.shift-box h4 {
  margin: 0 0 10px;
}

.shift-box label,
.table-checks label,
.bar-checks label {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 30px;
}

.shift-box input,
.table-checks input,
.bar-checks input {
  width: auto;
  min-height: auto;
}

.staff-layout {
  display: grid;
  grid-template-columns: minmax(320px, 1fr) minmax(280px, .8fr);
  gap: 14px;
}

.wide-panel {
  grid-column: 1 / -1;
}

.table-checks,
.bar-checks {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.table-checks[hidden],
.bar-checks[hidden] {
  display: none !important;
}

.table-checks strong,
.bar-checks strong {
  grid-column: 1 / -1;
}

.staff-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 10px;
}

.staff-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.staff-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.tag {
  border-radius: 999px;
  padding: 4px 9px;
  background: var(--soft);
  color: var(--ink);
  font-size: 13px;
}

.tree-node {
  border: 1px solid var(--line);
  border-radius: 8px;
  margin-bottom: 10px;
  background: #fff;
}

.tree-node summary {
  cursor: pointer;
  padding: 12px;
  font-weight: 800;
}

.tree-node.root > summary {
  background: var(--soft);
}

.tree-children {
  padding: 0 12px 10px;
}

.tree-children .tree-node {
  margin-left: 10px;
}

.color-field {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
}

.color-field input[type="color"] {
  width: 56px;
  min-height: 30px;
  padding: 0;
  border: 0;
  background: transparent;
}

.swatch {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 1px solid var(--line);
  border-radius: 4px;
  margin-right: 8px;
  vertical-align: -2px;
}

.shift-row {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
  background: transparent;
  color: inherit;
  text-align: left;
}

.shift-row.active {
  background: var(--soft);
}

.shift-details {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.shift-details h4 {
  margin: 0 0 8px;
}

.detail-block {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0;
}

.detail-block strong {
  width: 100%;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  min-width: 220px;
  border-radius: 8px;
  padding: 14px 16px;
  color: #fff;
  background: var(--brand);
  box-shadow: var(--shadow);
  font-weight: 800;
}

@media (max-width: 860px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

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

  .sidebar {
    position: sticky;
    top: 91px;
    z-index: 4;
    display: flex;
    gap: 8px;
    overflow-x: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .navbtn {
    width: auto;
    white-space: nowrap;
  }

  .content {
    padding: 16px;
  }

  .cols-2,
  .cols-3,
  .shift-groups,
  .staff-layout,
  .split,
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media print {
  body * {
    visibility: hidden;
  }

  .print-area,
  .print-area * {
    visibility: visible;
  }

  .print-area {
    position: absolute;
    inset: 0 auto auto 0;
    width: 320px;
    padding: 0;
  }
}
