/* ─── TOKENS ─────────────────────────────────────────── */
:root {
  --bg:        #08090d;
  --bg2:       #0d0f17;
  --bg3:       #13161f;
  --bg4:       #181b27;
  --acc:       #f1f5f9;
  --acc2:      rgba(241,245,249,0.07);
  --acc3:      rgba(241,245,249,0.03);
  --red:       #f87171;
  --red2:      rgba(248,113,113,0.10);
  --text:      #e2e8f0;
  --text2:     #94a3b8;
  --text3:     #475569;
  --brd:       rgba(255,255,255,0.07);
  --brd2:      rgba(255,255,255,0.14);
  --radius:    8px;
  --radius-lg: 12px;
  --font:      system-ui,-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
}

/* ─── RESET ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ─── LAYOUT ──────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: 1fr 320px;
  height: 100vh;
}

/* ─── MAIN PANEL ──────────────────────────────────────── */
.main {
  padding: 24px 28px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--bg);
}

.main::-webkit-scrollbar { width: 3px; }
.main::-webkit-scrollbar-track { background: transparent; }
.main::-webkit-scrollbar-thumb { background: var(--brd2); border-radius: 2px; }

/* ─── HEADER ──────────────────────────────────────────── */
.main-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  width: 30px;
  height: 30px;
  background: var(--bg3);
  border: 1px solid var(--brd2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: var(--acc);
}

.logo-text {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .01em;
  color: var(--text);
}

.shift-status {
  font-size: 11px;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: #4ade80;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .35; }
}

/* ─── SECTION LABEL ───────────────────────────────────── */
.sec-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text3);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sec-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--brd);
}

h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--text3);
}

/* ─── TOOLBAR ─────────────────────────────────────────── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.toolbar .left, .toolbar .right { display: flex; gap: 8px; }

/* ─── BUTTONS ─────────────────────────────────────────── */
button {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .02em;
  padding: 9px 16px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
  border: 1px solid var(--brd);
  background: transparent;
  color: var(--text2);
}

button:hover {
  border-color: var(--brd2);
  color: var(--text);
  background: var(--acc2);
}

/* primary */
button.btn-primary {
  background: var(--acc);
  color: #08090d;
  border-color: var(--acc);
  font-weight: 600;
}

button.btn-primary:hover {
  background: #ffffff;
  border-color: #ffffff;
}

button.danger {
  background: transparent;
  color: var(--red);
  border-color: rgba(248,113,113,.2);
}

button.danger:hover {
  background: var(--red2);
  border-color: var(--red);
  color: #fca5a5;
}

/* ─── INPUTS ──────────────────────────────────────────── */
input, select {
  width: 100%;
  padding: 11px 16px;
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 13px;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}

input:focus, select:focus {
  border-color: var(--brd2);
  box-shadow: 0 0 0 3px rgba(241,245,249,0.06);
}

input::placeholder { color: var(--text3); }
select option { background: var(--bg3); }

/* ─── SEARCH ──────────────────────────────────────────── */
#searchBox {
  padding-left: 40px;
}

.search-wrap {
  position: relative;
}

.search-wrap::before {
  content: '⌕';
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text3);
  font-size: 16px;
  pointer-events: none;
  z-index: 1;
}

#results {
  max-height: 210px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-top: 6px;
}

#results::-webkit-scrollbar { width: 3px; }
#results::-webkit-scrollbar-thumb { background: var(--brd2); border-radius: 2px; }

.result {
  padding: 9px 14px;
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 12px;
  color: var(--text2);
  transition: all .12s;
  display: flex;
  justify-content: space-between;
}

.result:hover { border-color: var(--brd2); color: var(--text); background: var(--acc2); }
.result.selected { border-color: var(--brd2); color: var(--text); background: var(--bg4); }

#qtyBox { margin-top: 8px; }

/* ─── CART TABLE ──────────────────────────────────────── */
.tbl-wrap {
  border: 1px solid var(--brd);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}

thead tr { background: var(--bg3); }

th {
  padding: 10px 14px;
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text3);
  text-align: left;
}

td {
  padding: 11px 14px;
  border-top: 1px solid var(--brd);
  color: var(--text2);
  transition: background .12s;
}

tbody tr:hover td { background: var(--acc3); }

td:first-child { color: var(--text); font-weight: 500; }

td:nth-child(2),
td:nth-child(3),
td:nth-child(4),
th:nth-child(2),
th:nth-child(3),
th:nth-child(4) {
  text-align: center;
  font-variant-numeric: tabular-nums;
}

td:nth-child(4) { color: var(--acc); font-weight: 600; }

td:last-child, th:last-child { width: 44px; text-align: center; }

.remove-btn {
  background: transparent;
  border: none;
  padding: 4px 8px;
  border-radius: 5px;
  color: var(--text3);
  font-size: 12px;
  cursor: pointer;
  transition: all .12s;
  display: flex;
  align-items: center;
}

.remove-btn:hover {
  color: var(--red);
  background: var(--red2);
  box-shadow: none;
  border-color: transparent;
}

/* ─── TOTALS ──────────────────────────────────────────── */
.total {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  border: 1px solid var(--brd);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: var(--bg3);
}

.total > div {
  padding: 16px 20px;
  position: relative;
}

.total > div:not(:last-child) {
  border-right: 1px solid var(--brd);
}

.total-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 8px;
}

#sellTotal, #buyTotal {
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -1px;
  line-height: 1;
  display: block;
}

#customPrice {
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--brd2);
  border-radius: 0;
  font-size: 24px;
  font-weight: 700;
  color: var(--acc);
  letter-spacing: -.5px;
  padding: 0 0 4px;
  width: 100%;
  outline: none;
  transition: border-color .15s;
}

#customPrice:focus {
  border-bottom-color: var(--acc);
  box-shadow: none;
}

/* ─── SIDE PANEL ──────────────────────────────────────── */
.side {
  background: var(--bg2);
  border-left: 1px solid var(--brd);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

.side-header {
  padding: 20px 18px 14px;
  flex-shrink: 0;
  border-bottom: 1px solid var(--brd);
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.side-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.clock {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  color: var(--text2);
  background: var(--bg3);
  border: 1px solid var(--brd);
  padding: 5px 11px;
  border-radius: var(--radius);
  letter-spacing: .04em;
  font-variant-numeric: tabular-nums;
}

/* ─── HISTORY ─────────────────────────────────────────── */
#historyList {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  padding-bottom: 185px;
}

#historyList::-webkit-scrollbar { width: 3px; }
#historyList::-webkit-scrollbar-thumb { background: var(--brd2); border-radius: 2px; }

.transaction {
  padding: 10px 12px;
  border: 1px solid var(--brd);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all .15s;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.transaction:hover {
  border-color: var(--brd2);
  background: var(--acc3);
}

.transaction strong {
  font-size: 11px;
  font-weight: 400;
  color: var(--text3);
  display: block;
}

.transaction span {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: -.3px;
  font-variant-numeric: tabular-nums;
}

/* ─── FINANCE ─────────────────────────────────────────── */
.finance {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  padding: 12px;
  background: var(--bg2);
  border-top: 1px solid var(--brd);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.finance-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.finance-box {
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: var(--radius);
  padding: 10px 12px;
  text-align: center;
}

.fb-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 4px;
}

.finance-box span {
  display: block;
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -.5px;
  font-variant-numeric: tabular-nums;
}

/* ─── WEEKLY BTN ──────────────────────────────────────── */
.weekly-btn {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--brd);
  color: var(--text2);
  font-weight: 500;
  font-size: 11px;
  padding: 9px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-radius: var(--radius);
  letter-spacing: .04em;
  text-transform: uppercase;
}

.weekly-btn:hover {
  background: var(--bg4);
  border-color: var(--brd2);
  color: var(--text);
}

.weekly-badge {
  background: var(--bg4);
  color: var(--text2);
  border: 1px solid var(--brd2);
  font-size: 10px;
  font-weight: 600;
  min-width: 20px;
  height: 20px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 5px;
}

/* ─── GEAR BTN ────────────────────────────────────────── */
#settingsBtn {
  position: fixed;
  bottom: 16px;
  left: 16px;
  width: 34px;
  height: 34px;
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 15px;
  z-index: 1001;
  transition: all .15s;
}

#settingsBtn:hover {
  border-color: var(--brd2);
  background: var(--bg4);
}

/* ─── MODALS ──────────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  justify-content: center;
  align-items: center;
  background: rgba(0,0,0,0.75);
  backdrop-filter: blur(4px);
  z-index: 1000;
}

.modal-box {
  background: var(--bg2);
  border: 1px solid var(--brd2);
  border-radius: 14px;
  padding: 28px;
  min-width: 320px;
  box-shadow: 0 32px 64px rgba(0,0,0,0.6), 0 0 0 1px var(--brd);
  animation: modalIn .2s ease;
}

@keyframes modalIn {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}

.modal-box h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: .02em;
  color: var(--text);
  margin-bottom: 18px;
}

.modal-box.details { width: 420px; }

.details-list {
  margin-top: 8px;
  line-height: 1.8;
  color: var(--text2);
  font-size: 13px;
}

.details-total {
  margin-top: 14px;
  padding: 14px 16px;
  background: var(--bg3);
  border: 1px solid var(--brd);
  border-radius: var(--radius);
  font-size: 13px;
  line-height: 2;
  color: var(--text2);
}

/* START MODAL */
#startModal .modal-box {
  width: 360px;
  text-align: center;
}

#startModal .modal-box h3 {
  font-size: 15px;
  margin-bottom: 20px;
}

#startModal button { width: 100%; margin-top: 8px; }

#startModal label {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text2);
  cursor: pointer;
}

#startModal input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--acc);
}

/* ─── TOAST ───────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: var(--bg3);
  border: 1px solid var(--brd2);
  padding: 11px 18px;
  border-radius: var(--radius);
  color: var(--text);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .02em;
  opacity: 0;
  transform: translateY(8px);
  transition: all .2s ease;
  z-index: 2000;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* ─── OVERRIDES ───────────────────────────────────────── */
#settingsModal { z-index: 2000; }
#startModal    { z-index: 1500; }

.field-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .10em;
  text-transform: uppercase;
  color: var(--text3);
  margin-bottom: 6px;
  display: block;
}
