* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  background: #1a1a2e;
  color: #eee;
  height: 100vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* ─── HEADER ─────────────────────────────────────────── */

header {
  background: #16213e;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #0f3460;
  box-shadow: 0 2px 10px rgba(0,0,0,0.3);
}

header h1 {
  font-size: 1.4rem;
  color: #e94560;
}

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

/* ─── BUTTONS ─────────────────────────────────────────── */

button {
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  font-weight: 600;
  transition: all 0.2s;
  touch-action: manipulation;
}

button:hover {
  opacity: 0.85;
  transform: translateY(-1px);
}

.btn-primary {
  background: #e94560;
  color: white;
}

.btn-secondary {
  background: #0f3460;
  color: #eee;
}

.btn-warning {
  background: #f5a623;
  color: #1a1a2e;
}

.btn-danger {
  background: #c0392b;
  color: white;
}

.hidden {
  display: none !important;
}

/* ─── GLAVNA POVRŠINA ─────────────────────────────────── */

main {
  flex: 1;
  position: relative;
  overflow: scroll;
}

#table-area {
  width: 1200px;
  height: 800px;
  position: relative;
  flex-shrink: 0;
}

#table-area::after {
  content: '';
  position: absolute;
  left: 65%;
  top: 0;
  bottom: 0;
  width: 2px;
  background: rgba(255,255,255,0.15);
  pointer-events: none;
}

#area-label-inside {
  position: absolute;
  left: 25px;
  top: 10px;
  color: rgba(255,255,255,0.2);
  font-size: 0.85rem;
  font-weight: 600;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 2px;
}

#area-label-terrace {
  position: absolute;
  left: 67%;
  top: 10px;
  color: rgba(255,255,255,0.2);
  font-size: 0.85rem;
  font-weight: 600;
  pointer-events: none;
  text-transform: uppercase;
  letter-spacing: 2px;
}

#btn-add-table {
  position: absolute;
  bottom: 24px;
  right: 24px;
  background: #e94560;
  color: white;
  font-size: 1rem;
  padding: 12px 24px;
  border-radius: 12px;
  z-index: 10;
}

/* ─── STOLOVI ─────────────────────────────────────────── */

.table-card {
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: 3px solid transparent;
  transition: all 0.2s;
  user-select: none;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
  z-index: 1;
}

.table-card:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0,0,0,0.4);
}

.table-card.free {
  background: #1b4332;
  border-color: #2d6a4f;
}

.table-card.occupied {
  background: #7b1d1d;
  border-color: #e94560;
}

.table-card .table-icon {
  font-size: 2.2rem;
  margin-bottom: 6px;
}

.table-card .table-name {
  font-size: 0.68rem;
  font-weight: 700;
  text-align: center;
  color: #eee;
}

.table-card .table-guest {
  font-size: 0.65rem;
  color: #aaa;
  margin-top: 2px;
  text-align: center;
} 

.table-card .table-amount {
  font-size: 0.95rem;
  font-weight: 800;
  color: #f9c74f;
  margin-top: 2px;
}

/* Edit mode */
.edit-mode .table-card {
  border-style: dashed;
  cursor: grab;
}

.edit-mode .table-card:active {
  cursor: grabbing;
}

.table-delete-btn {
  position: absolute;
  top: -8px;
  right: -8px;
  background: #e94560;
  color: white;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 0.7rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
  padding: 0;
}

.edit-mode .table-delete-btn {
  display: flex;
}

/* ─── MODALI ──────────────────────────────────────────── */

.modal {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-box {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 16px;
  padding: 20px;
  width: 380px;
  max-width: 95vw;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
  overflow-y: auto;
  overflow-x: hidden;
}

#session-form {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

#btn-close-session {
  flex-shrink: 0;
}

.modal-box h2 {
  color: #e94560;
  font-size: 1.2rem;
}

.modal-box input {
  width: 100%;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid #0f3460;
  background: #1a1a2e;
  color: #eee;
  font-size: 1rem;
}

.modal-box input:focus {
  outline: none;
  border-color: #e94560;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  flex-wrap: wrap;
  flex-shrink: 0;
  position: sticky;
  bottom: 0;
  background: #16213e;
  padding-top: 10px;
  margin-top: auto;
}

#session-info {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

#session-info strong {
  color: #f9c74f;
}

/* ─── IZVJEŠTAJ ───────────────────────────────────────── */

#report-content, #history-content {
  max-height: 50vh;
  overflow-y: auto;
}

.report-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #0f3460;
  font-size: 0.95rem;
}

.report-total {
  font-size: 1.1rem;
  font-weight: 800;
  color: #f9c74f;
  margin-top: 10px;
  text-align: right;
}

.history-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid #0f3460;
}

.history-item button {
  font-size: 0.8rem;
  padding: 5px 10px;
}

/* ─── LISTA IZNOSA ────────────────────────────────────── */

.session-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  border-bottom: 1px solid #0f3460;
}

.session-item-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.session-item-drinks {
  font-size: 0.78rem;
  color: #aaa;
  overflow-wrap: break-word;
}

.session-item-amount {
  font-weight: 700;
}

.session-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.item-repeat-btn {
  background: #1a3a6e;
  color: #f9c74f;
  border: none;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  font-size: 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s;
}

.item-repeat-btn:hover {
  background: #e94560;
  transform: scale(1.1);
}

.item-delete-btn {
  background: #c0392b;
  color: white;
  border: none;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  font-size: 0.7rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: all 0.2s;
}

.item-delete-btn:hover {
  background: #e94560;
  transform: scale(1.1);
}

.session-total-row {
  margin-top: 8px;
  font-size: 1rem;
}

.session-total-row strong {
  color: #f9c74f;
  font-size: 1.1rem;
}

/* ─── SANK ───────────────────────────────────────────── */

#sank {
  position: absolute;
  top: 0;
  left: 32%;
  width: 33%;
  height: 90px;
  background: rgba(233, 69, 96, 0.15);
  border: 2px solid rgba(233, 69, 96, 0.4);
  border-top: none;
  border-radius: 0 0 12px 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 3;
}

#sank span {
  color: rgba(233, 69, 96, 0.7);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 3px;
}

/* ─── PIN EKRAN ──────────────────────────────────────── */

#pin-screen {
  position: fixed;
  inset: 0;
  background: #1a1a2e;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

#pin-box {
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 20px;
  padding: 40px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 320px;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5);
}

#pin-box h2 {
  color: #e94560;
  font-size: 1.4rem;
}

#pin-box p {
  color: #aaa;
  font-size: 0.95rem;
}

#pin-dots {
  display: flex;
  gap: 16px;
}

.dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #0f3460;
  border: 2px solid #e94560;
  transition: background 0.2s;
}

.dot.filled {
  background: #e94560;
}

#pin-error {
  color: #e94560;
  font-size: 0.85rem;
  height: 16px;
}

#pin-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  width: 100%;
}

.pin-btn {
  background: #0f3460;
  color: #eee;
  border: none;
  border-radius: 12px;
  padding: 18px;
  font-size: 1.3rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.pin-btn:hover {
  background: #e94560;
  transform: scale(1.05);
}

#pin-submit {
  background: #2d6a4f;
  color: white;
}

#pin-submit:hover {
  background: #40916c;
}

/* ─── SAT ────────────────────────────────────────────── */

#header-clock {
  font-size: 1.2rem;
  font-weight: 700;
  color: #f9c74f;
  letter-spacing: 2px;
}

/* ─── FULLSCREEN & ODJAVA ────────────────────────────── */

#btn-logout {
  background: #2d3561;
  color: #eee;
}

/* ─── NUMPAD ZA IZNOS ────────────────────────────────── */

#amount-display {
  background: #0f3460;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 1.6rem;
  font-weight: 800;
  color: #f9c74f;
  text-align: right;
  width: 100%;
}

#session-numpad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  width: 100%;
}

.num-btn {
  background: #0f3460;
  color: #eee;
  border: none;
  border-radius: 10px;
  padding: 14px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.num-btn:hover {
  background: #e94560;
  transform: scale(1.05);
}

#num-clear {
  background: #7b1d1d;
}

#num-dot {
  background: #1a3a6e;
}

/* ─── SCROLLABLE LISTA IZNOSA ────────────────────────── */

#session-items-list {
  overflow-y: auto;
  max-height: 180px;
}

.session-total-row {
  flex-shrink: 0;
  margin-top: 4px;
  padding-top: 6px;
  font-size: 0.95rem;
  border-top: 1px solid #e94560;
  background: #16213e;
}

#session-form {
  flex-shrink: 0;
}
/* ─── DROPDOWN MENI ──────────────────────────────────── */

#dropdown-wrapper {
  position: relative;
}

#dropdown-menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #16213e;
  border: 1px solid #0f3460;
  border-radius: 12px;
  overflow: hidden;
  min-width: 200px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 200;
}

#dropdown-menu button {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 16px;
  background: transparent;
  color: #eee;
  border-radius: 0;
  font-size: 0.95rem;
  border-bottom: 1px solid #0f3460;
}

#dropdown-menu button:last-child {
  border-bottom: none;
}

#dropdown-menu button:hover {
  background: #0f3460;
  transform: none;
}

/* ─── PROMJENA PIN-a ─────────────────────────────────── */

.pin-dots-row {
  display: flex;
  gap: 12px;
  justify-content: center;
}

.pin-numpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  width: 100%;
}

.table-time {
  font-size: 0.6rem;
  color: #f9c74f;
  margin-top: 2px;
}

.table-edit-btn {
  position: absolute;
  top: -8px;
  left: -8px;
  background: #f5a623;
  color: #1a1a2e;
  border: none;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  font-size: 0.6rem;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 5;
  padding: 0;
}

.edit-mode .table-edit-btn {
  display: flex;
}

#btn-finish-edit {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: #2d6a4f;
  color: white;
  font-size: 1rem;
  padding: 12px 28px;
  border-radius: 12px;
  z-index: 10;
  box-shadow: 0 4px 15px rgba(0,0,0,0.3);
}

/* ─── REPORT TABELA ──────────────────────────────────── */

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

.report-table th {
  background: #0f3460;
  color: #eee;
  padding: 8px 6px;
  text-align: left;
  font-size: 0.8rem;
}

.report-table td {
  padding: 7px 6px;
  border-bottom: 1px solid #0f3460;
  color: #eee;
}

.report-table tr:nth-child(even) td {
  background: rgba(255,255,255,0.03);
}

.report-row-clickable {
  cursor: pointer;
}

.report-row-clickable:hover td {
  background: rgba(233, 69, 96, 0.12) !important;
}

.report-row-details td {
  background: #0f1a33 !important;
  padding: 8px 10px !important;
}

/* ─── KONOBARI ───────────────────────────────────────── */

#header-waiter {
  color: #f9c74f;
  font-size: 0.9rem;
  font-weight: 600;
}

.waiter-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid #0f3460;
}

.waiter-item button {
  font-size: 0.8rem;
  padding: 4px 10px;
}

/* ─── MOD UNOSA: IZNOS / PIĆA ────────────────────────── */

#entry-mode-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
}

.mode-btn-primary {
  flex: 1;
  background: #0f3460;
  color: #aaa;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 12px;
  font-size: 1rem;
  font-weight: 700;
}

.mode-btn-primary.active {
  background: #e94560;
  color: white;
  border-color: #e94560;
}

.mode-btn-secondary {
  flex-shrink: 0;
  background: transparent;
  color: #aaa;
  border: 1px solid #0f3460;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 600;
}

.mode-btn-secondary.active {
  background: #1a3a6e;
  color: #f9c74f;
  border-color: #f9c74f;
}

#amount-mode, #drinks-mode {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 0;
}

/* ─── PICKER PIĆA ─────────────────────────────────────── */

#drinks-category-tabs {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  flex-shrink: 0;
  margin-top: 4px;
  padding-top: 10px;
  padding-bottom: 4px;
  border-top: 1px solid #0f3460;
}

.drink-tab-btn {
  flex-shrink: 0;
  background: #0f3460;
  color: #aaa;
  border-radius: 20px;
  padding: 6px 14px;
  font-size: 0.78rem;
  white-space: nowrap;
}

.drink-tab-btn.active {
  background: #e94560;
  color: white;
}

#drinks-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  align-content: start;
  gap: 8px;
  max-height: 40vh;
  overflow-y: auto;
  flex-shrink: 0;
}

@media (max-height: 750px) {
  #drinks-grid { max-height: 28vh; }
}

@media (max-height: 600px) {
  #drinks-grid { max-height: 20vh; }
}

.drink-btn {
  position: relative;
  background: #0f3460;
  color: #eee;
  border-radius: 10px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
  text-align: left;
}

.drink-btn.has-qty {
  background: #1a3a6e;
  border: 2px solid #e94560;
}

.drink-btn .drink-name {
  font-size: 0.8rem;
  font-weight: 700;
}

.drink-btn .drink-price {
  font-size: 0.75rem;
  color: #f9c74f;
}

.drink-qty-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #e94560;
  color: white;
  border-radius: 50%;
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 800;
}

#drinks-selected-summary {
  max-height: 16vh;
  overflow-y: auto;
  flex-shrink: 0;
}

.drinks-summary-empty {
  color: #aaa;
  font-size: 0.85rem;
  text-align: center;
  padding: 6px 0;
}

.drinks-summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid #0f3460;
  font-size: 0.85rem;
}

.drinks-summary-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.summary-minus-btn {
  background: #7b1d1d;
  color: white;
  border-radius: 6px;
  width: 24px;
  height: 24px;
  font-size: 0.9rem;
  padding: 0;
}

#drinks-total-display {
  background: #0f3460;
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 1.2rem;
  font-weight: 800;
  color: #f9c74f;
  text-align: right;
  flex-shrink: 0;
}

/* ─── EXPORT PIĆA / CJENOVNIK ─────────────────────────── */

.modal-box-wide {
  width: 560px;
}

#drinks-report-controls {
  flex-shrink: 0;
}

#drinks-report-controls input[type="date"] {
  width: auto;
}

#drinks-report-content, #price-list-content {
  max-height: 55vh;
  overflow-y: auto;
}

.price-list-category {
  color: #f9c74f;
  font-size: 0.9rem;
  margin: 10px 0 4px;
}

.price-list-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 0;
  border-bottom: 1px solid #0f3460;
  font-size: 0.88rem;
}

.price-input {
  width: 80px !important;
  padding: 4px 8px !important;
  text-align: right;
}

/* ─── STANJE PIĆA ─────────────────────────────────────── */

.stock-hint {
  color: #aaa;
  font-size: 0.8rem;
}

.stock-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid #0f3460;
  font-size: 0.85rem;
}

.stock-name {
  flex: 1 1 160px;
  min-width: 0;
}

.stock-current {
  color: #f9c74f;
  font-weight: 700;
  min-width: 50px;
  text-align: right;
}

.stock-servings-label {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #aaa;
  font-size: 0.78rem;
}

.stock-servings-input {
  width: 60px !important;
  padding: 4px 6px !important;
  text-align: right;
}

.stock-servings-readonly {
  color: #aaa;
  font-weight: 600;
}

#stock-mode-tabs {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.stock-mode-btn {
  flex: 1;
  background: #0f3460;
  color: #aaa;
  border-radius: 8px;
  padding: 8px;
  font-size: 0.82rem;
  font-weight: 700;
}

.stock-mode-btn.active {
  background: #e94560;
  color: white;
}

.stock-batch-input {
  width: 90px !important;
  padding: 5px 8px !important;
  text-align: right;
  margin-left: auto;
}

/* ─── BROJANJE KASE ───────────────────────────────────── */

#cash-count-rows {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 55vh;
  overflow-y: auto;
}

.cash-count-row {
  display: grid;
  grid-template-columns: 1fr 80px 100px;
  align-items: center;
  gap: 8px;
}

.cash-count-label {
  font-weight: 600;
  color: #eee;
}

.cash-count-input {
  width: 100% !important;
  padding: 6px 8px !important;
  text-align: right;
}

.cash-count-subtotal {
  text-align: right;
  color: #f9c74f;
  font-weight: 700;
  font-size: 0.9rem;
}

#cash-count-total {
  background: #0f3460;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 1.4rem;
  font-weight: 800;
  color: #f9c74f;
  text-align: right;
}