:root {
  --bg: #f6efe6; --card: #ffffff; --ink: #2b1d14; --sub: #7a6656; --brown: #5d3a1a; --gold: #e8a94f;
  --line: #e6d8c6; --ok: #2e7d32; --bad: #c62828; --warn: #ef6c00;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #1d1510; --card: #2a1f18; --ink: #f3e9de; --sub: #b8a491; --line: #3d2f25; }
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--ink);
  font-family: "Segoe UI", Tahoma, "Noto Sans Arabic", Arial, sans-serif; font-size: 16px; }
.hidden { display: none !important; }
button { font: inherit; border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 12px; padding: 10px 14px; cursor: pointer; }
button.primary { background: var(--brown); color: #fff; border-color: var(--brown); }
button.big { width: 100%; padding: 14px; font-size: 18px; font-weight: bold; }
button.icon { padding: 4px 10px; font-size: 20px; background: transparent; border: none; color: #fff; }
input, textarea { font: inherit; width: 100%; padding: 12px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); margin-top: 6px; }
label { display: block; margin: 12px 0; color: var(--sub); }

.screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 16px; }
.login-box { width: 100%; max-width: 380px; background: var(--card); border-radius: 18px; padding: 24px;
  box-shadow: 0 6px 24px rgba(0,0,0,.12); text-align: center; }
.login-box label { text-align: right; }
.logo { width: 84px; height: 84px; border-radius: 20px; }
.err { color: var(--bad); margin-top: 12px; min-height: 20px; }

header { position: sticky; top: 0; z-index: 5; background: var(--brown); color: #fff; padding: 8px 12px 6px; }
.top { display: flex; align-items: center; gap: 8px; }
.top b { font-size: 18px; flex: 1; }
.who { font-size: 13px; opacity: .85; }
.times { display: flex; flex-wrap: wrap; gap: 4px 12px; font-size: 12px; opacity: .9; margin-top: 4px; }
.offline { background: var(--bad); padding: 0 8px; border-radius: 8px; }

main { padding: 12px 12px 86px; max-width: 760px; margin: 0 auto; }
nav { position: fixed; bottom: 0; left: 0; right: 0; display: flex; background: var(--card);
  border-top: 1px solid var(--line); padding-bottom: env(safe-area-inset-bottom); z-index: 6; }
nav button { flex: 1; border: none; border-radius: 0; background: transparent; padding: 8px 2px 10px;
  font-size: 12px; color: var(--sub); display: flex; flex-direction: column; align-items: center; gap: 2px; }
nav button .ic { font-size: 21px; }
nav button.on { color: var(--brown); font-weight: bold; border-top: 3px solid var(--gold); }
@media (prefers-color-scheme: dark) { nav button.on { color: var(--gold); } }

h2 { font-size: 18px; margin: 6px 2px 10px; }
.card { background: var(--card); border-radius: 14px; padding: 12px 14px; margin-bottom: 10px;
  border: 1px solid var(--line); }
.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 12px; }
.stat .k { color: var(--sub); font-size: 13px; }
.stat .v { font-size: 22px; font-weight: bold; margin-top: 4px; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0;
  border-bottom: 1px solid var(--line); }
.row:last-child { border-bottom: none; }
.row .n { font-weight: bold; }
.row .s { color: var(--sub); font-size: 13px; }
.num { font-weight: bold; white-space: nowrap; direction: ltr; }
.pos { color: var(--ok); } .neg { color: var(--bad); }
.tag { font-size: 11px; padding: 2px 8px; border-radius: 10px; color: #fff; white-space: nowrap; }
.search { margin: 0 0 10px; }
.empty { text-align: center; color: var(--sub); padding: 30px 10px; }

.alert { border-radius: 12px; padding: 10px 12px; margin-bottom: 8px; color: #fff; font-weight: bold; font-size: 15px; }
.k-stock { background: #212121; } .k-over { background: #c62828; } .k-late { background: #ef6c00; }
.k-near { background: #f9a825; color: #212121; } .k-exchange { background: #6d4c41; } .k-workers { background: #1565c0; }

.note { display: flex; gap: 10px; align-items: flex-start; }
.note .txt { flex: 1; white-space: pre-wrap; word-break: break-word; }
.note.done .txt { text-decoration: line-through; color: var(--sub); }
.pending { font-size: 12px; color: var(--warn); }
.toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: #333; color: #fff;
  padding: 10px 16px; border-radius: 12px; z-index: 20; max-width: 90%; text-align: center; }
.more button { width: 100%; margin-bottom: 8px; text-align: right; font-size: 17px; padding: 14px; }
