/* Χρώματα από το λογότυπο nutrimed. Για κείμενο/κουμπιά οι σκουρότερες αποχρώσεις (αντίθεση AA). */
:root {
  --lime: #C0D824;
  --orange: #F06C18;
  --olive: #566B0C;
  --olive-dark: #435409;
  --orange-dark: #B4500F;
  --ink: #1f2410;
  --muted: #5d6450;
  --line: #e3e7d6;
  --bg: #f6f8ef;
  --card: #ffffff;
  --mine: #eef5cc;
  --theirs: #ffffff;
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { min-height: 100dvh; }
#app { min-height: 100dvh; }
[hidden] { display: none !important; }

h1 { font-size: 1.6rem; margin: .4rem 0 .2rem; color: var(--olive); letter-spacing: .02em; }
h2 { font-size: 1.15rem; margin: 0; }
.muted { color: var(--muted); }
.small { font-size: .82rem; }
.error { color: #a1260d; min-height: 1em; margin: 0; }
.notice { background: #fff4ea; border-left: 4px solid var(--orange); padding: .6rem .8rem; border-radius: 8px; margin: 0; }
.loading { text-align: center; margin-top: 40vh; color: var(--olive); font-weight: 600; }
.center { text-align: center; }
.row { display: flex; align-items: center; gap: .5rem; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; justify-content: flex-end; }
.stack { display: flex; flex-direction: column; gap: .6rem; }

label { font-weight: 600; font-size: .9rem; }
input, textarea, select {
  font: inherit; font-size: 16px; /* χωρίς zoom στο iPhone */
  width: 100%; padding: .7rem .8rem; border: 1px solid #cfd5bd; border-radius: 10px; background: #fff; color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: 3px solid color-mix(in srgb, var(--lime) 70%, transparent); border-color: var(--olive); }
textarea { resize: none; }
fieldset { border: 1px solid var(--line); border-radius: 10px; padding: .6rem .8rem; }
legend { font-weight: 600; font-size: .9rem; padding: 0 .3rem; }
.check { display: flex; align-items: center; gap: .5rem; font-weight: 400; padding: .25rem 0; }
.check input { width: auto; }

button, .button {
  font: inherit; border: 0; border-radius: 10px; padding: .7rem 1rem; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center; gap: .3rem;
}
button:disabled { opacity: .55; cursor: default; }
.primary { background: var(--olive); color: #fff; font-weight: 600; }
.primary:hover:not(:disabled) { background: var(--olive-dark); }
.secondary { background: #fff; color: var(--olive); border: 1px solid var(--olive); font-weight: 600; }
.secondary.small, button.small { padding: .4rem .7rem; font-size: .88rem; }
.link { background: none; color: var(--orange-dark); padding: .35rem .4rem; font-weight: 600; }
.icon { background: none; font-size: 1.3rem; padding: .4rem; }
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }

/* Σύνδεση */
.auth { max-width: 420px; margin: 0 auto; padding: max(8vh, 2rem) 1rem 2rem; }
.brand { text-align: center; margin-bottom: 1.2rem; }
.brand p { margin: 0; }
.card { background: var(--card); border-radius: var(--radius); padding: 1.2rem; box-shadow: 0 1px 3px rgba(0,0,0,.06); }

/* Επάνω μπάρα */
.topbar {
  display: flex; align-items: center; justify-content: space-between; gap: .6rem;
  padding: calc(.6rem + env(safe-area-inset-top)) .9rem .6rem; background: #fff; border-bottom: 3px solid var(--lime);
  position: sticky; top: 0; z-index: 2;
}
.topbar .title { display: flex; align-items: center; gap: .6rem; min-width: 0; }
.topbar .title > div { min-width: 0; }
.topbar strong { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Συνομιλία */
.chat-screen { display: flex; flex-direction: column; height: 100dvh; max-width: 760px; margin: 0 auto; background: var(--bg); }
.hint { margin: 0; padding: .45rem .9rem; font-size: .82rem; color: var(--muted); background: #fbfcf6; border-bottom: 1px solid var(--line); }
.thread { flex: 1; overflow-y: auto; padding: .8rem; display: flex; flex-direction: column; gap: .35rem; overscroll-behavior: contain; }
.day { align-self: center; font-size: .75rem; color: var(--muted); background: #eceee3; padding: .15rem .6rem; border-radius: 99px; margin: .6rem 0 .2rem; }
.msg { max-width: min(80%, 520px); padding: .5rem .7rem .35rem; border-radius: 14px; box-shadow: 0 1px 1px rgba(0,0,0,.06); overflow-wrap: anywhere; }
.msg.mine { align-self: flex-end; background: var(--mine); border-bottom-right-radius: 4px; }
.msg.theirs { align-self: flex-start; background: var(--theirs); border-bottom-left-radius: 4px; }
.msg .body { white-space: pre-wrap; line-height: 1.4; }
.msg .meta { font-size: .7rem; color: var(--muted); text-align: right; margin-top: .15rem; }
.msg .tag { font-size: .7rem; font-weight: 700; color: var(--orange-dark); margin-bottom: .15rem; }
.att-img img { display: block; max-width: 100%; max-height: 320px; border-radius: 10px; margin-bottom: .25rem; }
.att-file { display: inline-block; padding: .4rem .6rem; background: rgba(0,0,0,.04); border-radius: 8px; color: var(--olive); font-weight: 600; text-decoration: none; margin-bottom: .25rem; }
.empty { color: var(--muted); text-align: center; margin: auto; padding: 2rem 1rem; }

.composer { border-top: 1px solid var(--line); background: #fff; padding: .5rem .6rem calc(.5rem + env(safe-area-inset-bottom)); }
.composer .row { align-items: flex-end; }
.composer textarea { border-radius: 20px; padding: .6rem .9rem; max-height: 160px; }
.composer .send { border-radius: 50%; width: 44px; height: 44px; padding: 0; flex: 0 0 auto; font-size: 1.1rem; }
.chip { display: flex; align-items: center; gap: .3rem; font-size: .85rem; background: var(--mine); border-radius: 99px; padding: .2rem .4rem .2rem .8rem; margin-bottom: .4rem; width: fit-content; max-width: 100%; overflow: hidden; }

/* Εισερχόμενα γραφείου */
.staff-screen { display: flex; flex-direction: column; height: 100dvh; }
.inbox { flex: 1; display: grid; grid-template-columns: minmax(260px, 340px) 1fr; min-height: 0; }
.sidebar { border-right: 1px solid var(--line); background: #fff; display: flex; flex-direction: column; min-height: 0; }
.searchbox { padding: .6rem; border-bottom: 1px solid var(--line); }
.clients { list-style: none; margin: 0; padding: 0; overflow-y: auto; flex: 1; }
.client { width: 100%; text-align: left; background: none; border-radius: 0; border-bottom: 1px solid var(--line); padding: .7rem .8rem; display: block; color: var(--ink); }
.client:hover { background: #fafbf4; }
.client.active { background: var(--mine); }
.client.inactive strong { color: var(--muted); text-decoration: line-through; }
.client .row { gap: .4rem; }
.client .preview { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; flex: 1; min-width: 0; }
.badge { background: var(--orange-dark); color: #fff; border-radius: 99px; font-size: .75rem; font-weight: 700; padding: .05rem .5rem; }
.pane { display: flex; flex-direction: column; min-height: 0; background: var(--bg); }
.pane-head { display: flex; align-items: center; gap: .6rem; padding: .6rem .9rem; background: #fff; border-bottom: 1px solid var(--line); }
.pane-head > div { flex: 1; min-width: 0; }
.only-mobile { display: none; }

@media (max-width: 760px) {
  .inbox { grid-template-columns: 1fr; }
  .inbox .pane { display: none; }
  .inbox.has-selection .sidebar { display: none; }
  .inbox.has-selection .pane { display: flex; }
  .only-mobile { display: inline-flex; }
  .staff-screen .topbar { flex-wrap: wrap; row-gap: .4rem; }
  .staff-screen .topbar .title { flex: 1 1 100%; }
  .staff-screen .topbar .row.wrap { flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-start; gap: .3rem .5rem; }
  .topbar .row.wrap .secondary { font-size: .8rem; padding: .35rem .55rem; white-space: nowrap; }
  .topbar .row.wrap .link { white-space: nowrap; }
}

/* Παράθυρα */
dialog { border: 0; border-radius: var(--radius); padding: 1.2rem; width: min(440px, calc(100vw - 2rem)); box-shadow: 0 10px 40px rgba(0,0,0,.25); }
dialog.wide { width: min(560px, calc(100vw - 2rem)); }
dialog::backdrop { background: rgba(20,25,10,.45); }
dialog h2 { margin-bottom: .6rem; }
.picker { max-height: 220px; overflow-y: auto; border-top: 1px solid var(--line); margin-top: .3rem; padding-top: .3rem; }

.toast { position: fixed; left: 50%; bottom: calc(1.2rem + env(safe-area-inset-bottom)); transform: translateX(-50%); background: var(--ink); color: #fff; padding: .7rem 1rem; border-radius: 10px; z-index: 100; max-width: calc(100vw - 2rem); box-shadow: 0 4px 16px rgba(0,0,0,.25); }
.toast.error { background: #8f1f0a; }
.toast.ok { background: var(--olive); }
