:root {
    --bg: #f3f7fa;
    --card: #ffffff;
    --primary: #0b7aa1;
    --accent: #59a5d8;
    --muted: #7b8a93;
    --danger: #e74c3c;
    --radius: 10px;
}

* {
    box-sizing: border-box
}

select {
    max-width: 200px;
}

body {
    font-family: Inter, Arial, Helvetica, sans-serif;
    margin: 0;
    padding: 0;
    background: linear-gradient(180deg, var(--bg), #eaf3f7);
    color: #123;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

header {
    position: sticky;
    top: 0;
    z-index: 40;
    background: linear-gradient(90deg, var(--primary), #074c57);
    color: #fff;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0 4px 18px rgba(4, 18, 22, 0.12);
}

.barrier {
    width: 100%;
    height: 100%;
    position: fixed;
    left: 0px;
    top: 0px;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 999;
}

body.show-back #backBtn {
    display: block
}

h1 {
    margin: 0;
    font-size: 1.15rem;
    font-weight: 600;
    text-align: center;
}

#loadingScreen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

#loadingText {
    padding: 16px 24px;
    background: #fff;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(16, 32, 48, 0.1);
    font-size: 1.1rem;
    font-weight: 500;
    color: #123;
    text-align: center;
}

#screenContainer {
    flex: 1;
    padding: 18px;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto 36px;
}

.scrn {
    display: none;
    padding: 18px;
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 6px 20px rgba(16, 32, 48, 0.06);
}

.scrn.active {
    display: block
}

.btn {
    display: inline-block;
    width: 100%;
    padding: 12px 16px;
    margin: 10px 0;
    font-size: 1rem;
    cursor: pointer;
    background: linear-gradient(180deg, var(--accent), #3f9fc7);
    color: #fff;
    border: none;
    border-radius: 8px;
    box-shadow: 0 6px 12px rgba(8, 52, 72, 0.08);
}

.smallBtn {
    display: inline-block;
    padding: 6px 8px;
    font-size: 1rem;
    cursor: pointer;
    background: linear-gradient(180deg, var(--accent), #3f9fc7);
    color: #fff;
    border: none;
    border-radius: 8px;
    box-shadow: 0 6px 12px rgba(8, 52, 72, 0.08);
}
.iconBtn {
    display: inline-block;
    padding: 6px 8px;
    font-size: 1rem;
    cursor: pointer;
    color: #fff;
    border: none;
    border-radius: 8px;
    box-shadow: 0 6px 12px rgba(8, 52, 72, 0.08);
    background-size: 65%;
    background-repeat: no-repeat;
    background-position: center;
    background-color: #3f9fc7;
    height: 30px;
    aspect-ratio: 1 / 1;
}

/* form controls */
input[type="number"],
input[type="text"],
input[type="date"],
select {
    padding: 8px 10px;
    border-radius: 6px;
    border: 1px solid #d6e3ea;
    background: #fbfeff;
    color: #123;
    font-size: 0.95rem;
}

label {
    display: inline-block;
    margin: 8px 6px 6px 0;
    color: var(--muted);
    font-size: 0.95rem
}

/* Searchable Dropdown Styles */
.searchable-dropdown-container {
    position: relative;
    display: inline-block;
    width: 100%;
    max-width: 300px;
}

.searchable-dropdown-input {
    width: 100%;
    padding: 8px 10px !important;
    border-radius: 6px !important;
    border: 1px solid #d6e3ea !important;
    background: #fbfeff !important;
    color: #123 !important;
    font-size: 0.95rem !important;
    box-sizing: border-box;
}

.searchable-dropdown-input:focus {
    outline: none;
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 2px rgba(11, 122, 161, 0.1);
}

.searchable-dropdown-list {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: #fff;
    border: 1px solid #d6e3ea;
    border-top: none;
    border-radius: 0 0 6px 6px;
    max-height: 250px;
    overflow-y: auto;
    z-index: 100;
    box-shadow: 0 4px 12px rgba(16, 32, 48, 0.1);
}

.searchable-dropdown-item {
    padding: 10px;
    cursor: pointer;
    color: #123;
    font-size: 0.95rem;
    border-bottom: 1px solid #edf6fb;
    transition: background-color 0.15s;
}

.searchable-dropdown-item:last-child {
    border-bottom: none;
}

.searchable-dropdown-item:hover {
    background-color: #e8f4f9;
}

.searchable-dropdown-item.highlighted {
    background-color: #d4ecf6;
}

.searchable-dropdown-item-text {
    display: block;
}

.searchable-dropdown-item-code {
    font-size: 0.85rem;
    color: var(--muted);
}

.tableDiv {
    width: 100%;
    overflow: auto;
    margin-top: 12px
}

table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    min-width: 720px
}

table thead th {
    position: sticky;
    top: 0;
    background: linear-gradient(180deg, #f8fbfc, #eef7fb);
    color: #123;
    padding: 10px;
    border-bottom: 1px solid #e3eef4;
    text-align: center;
    font-weight: 600
}

table tbody tr:nth-child(odd) {
    background: linear-gradient(90deg, #ffffff, #fbfeff)
}

table tbody tr:nth-child(even) {
    background: #fcfdff
}

th,
td {
    padding: 10px;
    border-bottom: 1px solid #edf6fb;
    text-align: center;
    color: #123
}

.totalRow td {
    font-weight: 700;
    background: linear-gradient(90deg, #f2fafc, #e9f6fb)
}

.deleteBtn {
    background: var(--danger);
    color: #fff;
    border: none;
    padding: 6px 10px;
    border-radius: 6px;
    cursor: pointer
}

.creditCheckbox {
    transform: scale(1.05);
    margin-left: 8px
}

/* Responsive */
@media (max-width:900px) {
    #screenContainer {
        padding: 12px
    }

    table {
        min-width: 640px
    }
}

@media (max-width:600px) {
    header {
        padding: 12px
    }

    h1 {
        font-size: 1rem
    }

    .btn {
        padding: 12px
    }

    table {
        font-size: 0.88rem
    }
}

/* =======================
   FULLSCREEN OVERLAY
======================= */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  
  display: flex;
  justify-content: center;
  align-items: center;

  background: rgba(0, 0, 0, 0.4); /* translucent effect */
  backdrop-filter: blur(6px);

  opacity: 0;
  visibility: hidden;
  transition: opacity 0.25s ease, visibility 0.25s ease;
  z-index: 9999;
}

/* Active state */
.overlay.show {
  opacity: 1;
  visibility: visible;
}

.loader-box {
  padding: 20px 30px;
  background: rgba(255, 255, 255, 0.15);
  color: white;
  font-size: 18px;
  border-radius: 12px;
  backdrop-filter: blur(10px);
  animation: popIn 0.3s ease;
}

/* =======================
   SNACKBAR
======================= */
.snackbar {
  position: fixed;
  bottom: -100px;
  left: 50%;
  transform: translateX(-50%);

  background: #333;
  color: white;
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 14px;

  opacity: 0;
  transition: all 0.4s ease;
  z-index: 10000;
}

/* Show snackbar */
.snackbar.show {
  bottom: 30px;
  opacity: 1;
  animation: slideUp 0.4s ease;
}

/* =======================
   ANIMATIONS
======================= */
@keyframes popIn {
  from {
    transform: scale(0.8);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

@keyframes slideUp {
  from {
    transform: translate(-50%, 100px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}