/* tem — βιβλίο παραγγελιών · ανοιχτό, γειωμένο, απαλές σκιές */
:root {
  --bg: #f4f2ed;
  --card: #ffffff;
  --line: #e6e2d9;
  --line-strong: #d6d1c5;
  --ink: #1d1f1e;
  --muted: #6c6f6b;
  --accent: #1d4d3f;
  --accent-ink: #ffffff;
  --accent-soft: #e5efe9;
  --pos: #137047;
  --pos-bg: #e7f4ec;
  --neg: #b42318;
  --neg-bg: #fdecea;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(30, 28, 20, .05), 0 6px 20px rgba(30, 28, 20, .05);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 15px/1.45 var(--font); }
a { color: inherit; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 14px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 22px 0 10px; }
.muted { color: var(--muted); }
.inline { display: inline; margin: 0; }
[hidden] { display: none !important; }
svg { fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- κουμπιά / πεδία ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 40px; padding: 0 16px; border-radius: 10px; border: 1px solid transparent;
  font: 600 14px/1 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
  background: transparent; color: var(--ink); transition: background .15s, border-color .15s;
}
.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #163d32; }
.btn-outline { border-color: var(--line-strong); background: var(--card); }
.btn-outline:hover { border-color: var(--accent); }
.btn-ghost { color: var(--muted); }
.btn-ghost:hover { background: rgba(0, 0, 0, .05); color: var(--ink); }
.btn-danger { background: var(--neg); color: #fff; }
.btn-danger-text { color: var(--neg); }
.btn-danger-text:hover { background: var(--neg-bg); color: var(--neg); }
.btn-block { width: 100%; }
.btn-sm { height: 32px; padding: 0 10px; font-size: 13px; }
.icon-btn { border: 0; background: none; font-size: 26px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.icon-btn:hover { background: rgba(0, 0, 0, .05); }

input[type=text], input[type=password], input[type=search], input[type=date], select, textarea {
  width: 100%; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-strong); border-radius: 10px;
  background: #fff; color: var(--ink); font: 15px/1.35 var(--font);
}
textarea { resize: none; overflow: hidden; display: block; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(29, 77, 63, .15); }
input.bad { border-color: var(--neg); background: #fff7f6; }
.fld { display: block; margin-bottom: 14px; }
.fld > span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.row-form { display: flex; gap: 8px; }
.row-form input { flex: 1; }

/* ---------- κορυφή ---------- */
.top { background: var(--card); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 20; }
.top-in { max-width: 1180px; margin: 0 auto; padding: 0 16px; height: 58px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand { display: inline-flex; align-items: baseline; gap: 10px; text-decoration: none; }
.brand-mark { font-weight: 800; font-size: 22px; letter-spacing: -.02em; color: var(--accent); }
.brand-sub { color: var(--muted); font-weight: 600; }
.top-actions { display: flex; align-items: center; gap: 4px; }

.wrap { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }

/* ---------- λίστα ---------- */
.head-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px; }
.tabs::-webkit-scrollbar { display: none; }
.tab { padding: 8px 14px; border-radius: 999px; text-decoration: none; font-weight: 600; color: var(--muted); white-space: nowrap; border: 1px solid transparent; }
.tab:hover { background: rgba(0, 0, 0, .04); color: var(--ink); }
.tab.on { background: var(--card); border-color: var(--line-strong); color: var(--ink); box-shadow: var(--shadow); }

.filters { display: flex; gap: 8px; margin-bottom: 16px; align-items: center; }
.search { position: relative; flex: 1; max-width: 420px; }
.search svg { position: absolute; left: 11px; top: 50%; width: 18px; height: 18px; transform: translateY(-50%); color: var(--muted); }
.search input { padding-left: 36px; }
.filters select { width: auto; min-width: 180px; }

.tiles { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; margin-bottom: 16px; }
.tiles-order { grid-template-columns: repeat(4, 1fr); }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px 16px; min-width: 0; }
.tile span { display: block; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.tile b { display: block; font-size: 24px; letter-spacing: -.01em; margin-top: 4px; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tile small { display: block; color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.tile-profit.pos { background: var(--pos-bg); border-color: #cfe7d8; }
.tile-profit.pos b { color: var(--pos); }
.tile-profit.neg { background: var(--neg-bg); border-color: #f5cdc8; }
.tile-profit.neg b { color: var(--neg); }

.table-card { overflow: hidden; }
table.orders { width: 100%; border-collapse: collapse; }
.orders th { text-align: left; font-size: 12.5px; font-weight: 600; color: var(--muted); padding: 12px 16px; border-bottom: 1px solid var(--line); background: #fbfaf7; }
.orders td { padding: 12px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.orders tbody tr { cursor: pointer; transition: background .12s; }
.orders tbody tr:hover { background: #faf8f3; }
.orders tbody tr:last-child td { border-bottom: 0; }
.orders .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.c-num a { font-weight: 700; text-decoration: none; }
.c-date, .c-shop { color: var(--muted); white-space: nowrap; }
.c-items { display: flex; align-items: center; gap: 10px; }
.thumbs { display: inline-flex; }
.thumbs img { width: 36px; height: 36px; object-fit: cover; border-radius: 8px; border: 2px solid #fff; background: #eee; margin-left: -8px; box-shadow: 0 0 0 1px var(--line); }
.thumbs img:first-child { margin-left: 0; }
.cnt { color: var(--muted); font-size: 13.5px; white-space: nowrap; }
td.pos { color: var(--pos); font-weight: 700; }
td.neg { color: var(--neg); font-weight: 700; }
td.zero { color: var(--muted); }

.empty, .empty-first { padding: 36px 24px; text-align: center; }
.empty p { margin: 4px 0; }
.empty-first { max-width: 520px; margin: 40px auto; }
.empty-first h1 { margin-bottom: 6px; }
.empty-first .row-form { margin-top: 18px; }

/* ---------- παραγγελία ---------- */
.back { display: inline-block; margin-bottom: 12px; color: var(--muted); text-decoration: none; font-weight: 600; }
.back:hover { color: var(--ink); }
.order-head { padding: 18px 18px 4px; margin-bottom: 16px; }
.oh-grid { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1fr; gap: 0 14px; }
.fld-notes { grid-column: 1 / -1; }
.fld-num input { font-weight: 700; }
.save-state { font-size: 13px; font-weight: 600; color: var(--muted); }
.save-state.saved { color: var(--pos); }
.save-state.err { color: var(--neg); }

.items-card { padding: 16px 18px 18px; }
.items-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; }
.items-btns { display: flex; gap: 8px; }
.items-head, .item {
  display: grid; grid-template-columns: 88px minmax(0, 1fr) 64px 112px 112px 112px 104px 36px; gap: 12px; align-items: start;
}
.items-head { padding: 0 0 8px; border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 600; color: var(--muted); }
.items-head span:nth-child(3) { text-align: center; }
.items-head span:nth-child(4), .items-head span:nth-child(5), .items-head span:nth-child(6), .items-head span:nth-child(7) { text-align: right; padding-right: 2px; }
.item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.item .f > span { display: none; }
.item .f input { text-align: right; font-variant-numeric: tabular-nums; }
.item .f-qty input { text-align: center; }
.item .txt { min-height: 88px; }
.f-pr b { display: block; text-align: right; padding: 10px 2px 0; font-variant-numeric: tabular-nums; white-space: nowrap; }
.f-pr b.pos { color: var(--pos); }
.f-pr b.neg { color: var(--neg); }
.f-pr b.zero { color: var(--muted); font-weight: 600; }

.ph {
  width: 88px; height: 88px; border-radius: 12px; border: 1.5px dashed var(--line-strong); background: #faf9f6;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  color: var(--muted); font: 600 11.5px var(--font); cursor: pointer; padding: 0; overflow: hidden;
}
.ph svg { width: 26px; height: 26px; }
.ph:hover { border-color: var(--accent); color: var(--accent); }
.ph.has { border: 1px solid var(--line); background: #fff; }
.ph img { width: 100%; height: 100%; object-fit: cover; display: block; }
.del { width: 36px; height: 40px; border: 0; background: none; color: var(--muted); border-radius: 9px; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.del svg { width: 19px; height: 19px; }
.del:hover { background: var(--neg-bg); color: var(--neg); }

.drop-hint { margin-top: 14px; padding: 14px; border: 1.5px dashed var(--line-strong); border-radius: 12px; text-align: center; color: var(--muted); font-size: 13.5px; }
.items-card.no-items .items-head { display: none; }
.items-card.no-items .drop-hint { padding: 36px 14px; }

.danger-zone { margin-top: 18px; text-align: right; }

.drop-overlay { position: fixed; inset: 0; z-index: 50; display: none; align-items: center; justify-content: center; background: rgba(29, 77, 63, .12); pointer-events: none; }
.drop-overlay.show { display: flex; }
.drop-overlay div { background: var(--card); border: 2px dashed var(--accent); border-radius: 18px; padding: 28px 36px; font-weight: 700; color: var(--accent); box-shadow: var(--shadow); }

/* ---------- παράθυρα ---------- */
.dlg { border: 0; border-radius: 16px; padding: 20px; width: min(420px, calc(100vw - 32px)); box-shadow: 0 20px 60px rgba(0, 0, 0, .2); color: var(--ink); }
.dlg::backdrop { background: rgba(25, 25, 20, .45); }
.dlg h2 { margin-bottom: 10px; }
.dlg-wide { width: min(520px, calc(100vw - 32px)); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; }
.dlg-body { color: var(--muted); margin-bottom: 4px; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; flex-wrap: wrap; }
.pick-list { display: grid; gap: 8px; }
.shop-list { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 8px; }
.shop-list li { display: flex; gap: 8px; align-items: center; }
.pass-form { display: grid; }
.confirm-prev { display: flex; gap: 12px; align-items: center; }
.confirm-prev img { width: 56px; height: 56px; border-radius: 10px; object-fit: cover; }
.dlg-photo { width: min(900px, calc(100vw - 32px)); padding: 14px; }
.dlg-photo img { display: block; width: 100%; max-height: 72vh; object-fit: contain; border-radius: 10px; background: #f3f2ef; }

.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #23251f; color: #fff; padding: 11px 18px; border-radius: 12px; font-weight: 600; font-size: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .2); transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100vw - 32px);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--neg); }

/* ---------- είσοδος ---------- */
body.auth { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.auth-card { background: var(--card); border: 1px solid var(--line); border-radius: 18px; box-shadow: var(--shadow); padding: 28px 24px; width: min(380px, 100%); }
.auth-card .brand { margin-bottom: 22px; }
.auth-card h1 { margin-bottom: 8px; }
.auth-card p { margin: 0 0 16px; }
.auth-card form { margin-top: 8px; }
.alert { background: var(--neg-bg); color: var(--neg); padding: 10px 12px; border-radius: 10px; font-weight: 600; }

/* ---------- κινητό ---------- */
@media (max-width: 760px) {
  input[type=text], input[type=password], input[type=search], input[type=date], select, textarea { font-size: 16px; }
  .top-in { height: 54px; }
  .brand-sub { display: none; }
  .wrap { padding-top: 14px; }
  .head-row { flex-direction: column; align-items: stretch; }
  .head-row .btn { width: 100%; }
  .filters { flex-wrap: wrap; }
  .search { max-width: none; flex-basis: 100%; }
  .filters select { flex: 1; min-width: 0; }
  .tiles { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tiles-order { grid-template-columns: 1fr 1fr; gap: 10px; }
  .tiles:not(.tiles-order) .tile-profit { grid-column: 1 / -1; }
  .tile b { font-size: 20px; }

  .orders thead { display: none; }
  .orders, .orders tbody { display: block; }
  .orders tr {
    display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
    padding: 12px 14px; border-bottom: 1px solid var(--line);
  }
  .orders tbody tr:last-child { border-bottom: 0; }
  .orders td { padding: 0; border: 0; min-width: 0; }
  .c-num { order: 1; font-size: 16px; }
  .c-date { order: 2; }
  .c-profit { order: 3; margin-left: auto; font-size: 16px; }
  .c-shop { order: 4; flex-basis: 100%; font-size: 13px; overflow: hidden; text-overflow: ellipsis; }
  .c-items { order: 5; flex-basis: 100%; }
  .c-cost, .c-credit, .c-sell { order: 6; text-align: left !important; font-size: 13px; color: var(--muted); }
  .c-cost::before, .c-credit::before, .c-sell::before { content: attr(data-l) " "; }

  .order-head { padding: 14px 14px 2px; }
  .oh-grid { grid-template-columns: 1fr 1fr; }
  .fld-num { grid-column: 1 / -1; }
  .items-card { padding: 14px; }
  .items-top { flex-wrap: wrap; }
  .items-btns { flex: 1; justify-content: flex-end; }
  .items-head { display: none; }
  .item {
    grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px;
    grid-template-areas: none;
  }
  .item .ph { grid-column: 1 / 4; grid-row: 1; width: 100%; height: auto; aspect-ratio: 1; }
  .item .txt { grid-column: 4 / 12; grid-row: 1; min-height: 76px; margin-right: 4px; }
  .item .del { grid-column: 12 / 13; grid-row: 1; width: 36px; justify-self: end; margin-right: -6px; }
  .item .f-qty { grid-column: 1 / 3; grid-row: 2; }
  .item .f-buy { grid-column: 3 / 8; grid-row: 2; }
  .item .f-sell { grid-column: 8 / 13; grid-row: 2; }
  .item .f-cred { grid-column: 1 / 6; grid-row: 3; }
  .item .f-pr { grid-column: 6 / 13; grid-row: 3; align-self: end; padding-bottom: 10px; display: flex; justify-content: flex-end; align-items: baseline; gap: 8px; }
  .item .f > span { display: block; font-size: 11.5px; font-weight: 600; color: var(--muted); margin-bottom: 3px; }
  .item .f-pr > span { margin: 0; }
  .f-pr b { padding: 0; }
  .item .f input { padding-left: 8px; padding-right: 8px; }
  .danger-zone { text-align: center; }
}
td.c-credit.zero { color: var(--muted); }
