/* Uniforma Clasa a V-a 🤖 Robotica — stil mobile-first */

:root {
  --blue:      #2f8fd0;
  --blue-dark: #1d6ba3;
  --navy:      #0f2740;
  --green:     #34b44a;
  --bg:        #f4f6f9;
  --card:      #ffffff;
  --text:      #14202c;
  --muted:     #6b7a8c;
  --line:      #e3e8ef;
  --danger:    #d64545;
  --radius:    20px;
  --shadow:    0 1px 2px rgba(15, 39, 64, .05), 0 8px 24px rgba(15, 39, 64, .07);
  --shadow-lg: 0 20px 48px rgba(15, 39, 64, .18);
  --safe-b:    env(safe-area-inset-bottom, 0px);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:     #0d1620;
    --card:   #16222f;
    --text:   #e8eef5;
    --muted:  #8fa1b4;
    --line:   #24303f;
    --navy:   #0a1220;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 16px;
  line-height: 1.45;
}

.hidden { display: none !important; }
.muted  { color: var(--muted); }
.error  { color: var(--danger); font-size: .9rem; margin: 4px 0 0; }

/* ------------------------------------------------------------------ login */

.login {
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: 24px 18px calc(24px + var(--safe-b));
  background:
    radial-gradient(120% 80% at 50% -10%, #3a9bdd 0%, #1d6ba3 45%, var(--navy) 100%);
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card);
  border-radius: 26px;
  padding: 28px 22px 24px;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.brand    { width: 132px; height: auto; margin-bottom: 14px; border-radius: 8px; }
.brand-sm { width: 62px;  height: auto; border-radius: 6px; flex: none; }

.login-card h1 { font-size: 1.32rem; margin: 0; letter-spacing: -.02em; }
.bot {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -.24em;
  margin-right: .3em;
  flex: none;
}
.subbrand {
  font-size: 1.02rem;
  font-weight: 650;
  color: var(--blue);
  letter-spacing: .01em;
  margin-bottom: 4px;
}
.login-card p  { margin: 0 0 20px; font-size: .95rem; }
.login-card form { text-align: left; }

/* ------------------------------------------------------------------ forms */

.field { display: block; margin-bottom: 14px; }
.field > span {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: .02em;
  margin-bottom: 6px;
}

input[type="tel"], input[type="text"], input[type="password"] {
  width: 100%;
  font: inherit;
  color: var(--text);
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 14px;
  padding: 13px 14px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 4px rgba(47, 143, 208, .16);
}
input.invalid { border-color: var(--danger); }

/* ----------------------------------------------------------------- butoane */

.btn {
  font: inherit;
  font-weight: 650;
  border: none;
  border-radius: 14px;
  padding: 14px 20px;
  background: var(--line);
  color: var(--text);
  cursor: pointer;
  transition: transform .1s, filter .15s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn.primary {
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%);
  color: #fff;
  box-shadow: 0 6px 16px rgba(29, 107, 163, .32);
}
.btn.danger  { background: var(--danger); color: #fff; }
.btn.block   { width: 100%; display: block; }
.btn[disabled] { opacity: .5; pointer-events: none; }

.ghost {
  font: inherit;
  font-size: .85rem;
  font-weight: 600;
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 7px 11px;
  text-decoration: none;
  cursor: pointer;
}

/* ----------------------------------------------------------------- topbar */

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top, 0px)) 14px 10px;
  background: var(--navy);
  color: #fff;
}
.topbar-txt { display: flex; flex-direction: column; line-height: 1.2; flex: 1; min-width: 0; }
.topbar-txt strong { font-size: .78rem; white-space: nowrap; overflow: hidden;
  text-overflow: ellipsis; display: flex; align-items: center; }
.topbar-txt span   { font-size: .78rem; color: #a9bdd2; }

.banner {
  background: #fff4d6;
  color: #7a5200;
  padding: 12px 16px;
  font-size: .9rem;
  border-bottom: 1px solid #f0e0b0;
}
.banner.ok { background: #e4f6e8; color: #1c6b30; border-color: #c6e9cf; }

/* ---------------------------------------------------------------- content */

.content { padding: 10px 12px 0; max-width: 640px; margin: 0 auto; }

.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 14px;
  margin-bottom: 10px;
}
.card.student .field { margin-bottom: 0; }
.card.student .hint { margin-top: 8px; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.req { color: var(--danger); font-weight: 700; }
.pupil { display: flex; flex-direction: column; gap: 2px; }
.pupil-label {
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: var(--muted);
}
.pupil strong { font-size: 1.12rem; letter-spacing: -.01em; }
.pupil-parent { font-size: .8rem; color: var(--muted); }
.card.student .hint { margin-top: 8px; }
.sub-hint { display: block; margin-top: 5px; font-size: .76rem; color: var(--muted); }

.notice {
  margin: 0 0 12px;
  padding: 10px 12px;
  font-size: .82rem;
  line-height: 1.4;
  color: var(--muted);
  background: var(--bg);
  border-left: 3px solid var(--blue);
  border-radius: 0 10px 10px 0;
}
.notice strong { color: var(--text); }
.notice em { font-style: normal; font-weight: 650; color: var(--blue-dark); }
@media (prefers-color-scheme: dark) { .notice em { color: #6cbcf0; } }
.hint { font-size: .8rem; color: var(--muted); margin: 0; }

/* --------------------------------------------------------------- produse */

.product { padding: 0; overflow: hidden; }

.product-head {
  display: flex;
  gap: 10px;
  padding: 10px 12px;
  align-items: center;
}
.product-img {
  width: 46px;
  height: 46px;
  border-radius: 10px;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  flex: none;
}
/* butoanele din dreapta cardului, unul sub celălalt */
.product-actions {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: none;
}
.pill {
  font: inherit;
  font-size: .75rem;
  font-weight: 650;
  white-space: nowrap;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--muted);
  border-radius: 10px;
  padding: 7px 9px;
  cursor: pointer;
}
.pill.accent {
  background: linear-gradient(180deg, var(--blue) 0%, var(--blue-dark) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 3px 10px rgba(29, 107, 163, .28);
}
.pill[disabled] { opacity: .5; pointer-events: none; }
.product-info { flex: 1; min-width: 0; }
.product-info h2 { font-size: .95rem; margin: 0 0 1px; letter-spacing: -.01em; line-height: 1.2; }
.product-info .mat { font-size: .78rem; color: var(--muted); }
.product-info .mat strong { color: var(--blue-dark); }
.price { font-weight: 700; color: var(--blue-dark); font-size: .98rem; }
@media (prefers-color-scheme: dark) { .price { color: #6cbcf0; } }

.badge-qty {
  background: var(--green);
  color: #fff;
  font-size: .74rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 1px 7px;
  white-space: nowrap;
  margin-left: 6px;
}

/* chips de măsuri */
.sizes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0;
}
.chip {
  font: inherit;
  font-size: .92rem;
  font-weight: 600;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 12px;
  padding: 11px 14px;
  min-width: 64px;
  cursor: pointer;
  transition: all .12s;
}
.chip.on {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
  box-shadow: 0 4px 12px rgba(47, 143, 208, .3);
}

/* linii selectate */
.lines { border-top: 1px solid var(--line); }
.line {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
}
.line:last-child { border-bottom: none; }
.line .lbl { flex: 1; font-weight: 600; font-size: .92rem; }
.line .sub { font-size: .82rem; color: var(--muted); min-width: 72px; text-align: right; }

.stepper { display: flex; align-items: center; gap: 2px; }
.stepper button {
  width: 30px;
  height: 30px;
  font-size: 1.05rem;
  font-weight: 700;
  line-height: 1;
  border: 1.5px solid var(--line);
  background: var(--card);
  color: var(--text);
  border-radius: 10px;
  cursor: pointer;
}
.stepper button:active { background: var(--line); }
.stepper .qty { min-width: 30px; text-align: center; font-weight: 700; }

.tips { padding: 12px 14px; }
.tips summary { font-size: .88rem; font-weight: 650; cursor: pointer; }
.tips ul { margin: 8px 0 0; padding-left: 18px; font-size: .82rem; color: var(--muted); }
.tips li { margin-bottom: 4px; }

.footnote { text-align: center; font-size: .78rem; color: var(--muted); margin: 4px 0; }
.spacer { height: 88px; }

/* -------------------------------------------------------------- bottombar */

.bottombar {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  z-index: 25;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px calc(12px + var(--safe-b));
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
}
.bottombar .sum { flex: 1; display: flex; flex-direction: column; line-height: 1.2; }
.bottombar .sum strong { font-size: 1.18rem; letter-spacing: -.02em; }
.bottombar .sum span   { font-size: .78rem; }
.bottombar .btn { padding: 14px 22px; }

/* ------------------------------------------------------------- sheet/modal */

.sheet-wrap { position: fixed; inset: 0; z-index: 60; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(6, 18, 30, .55); }
.sheet {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  max-height: 86dvh;
  overflow: auto;
  background: var(--card);
  border-radius: 24px 24px 0 0;
  padding: 10px 16px calc(16px + var(--safe-b));
  box-shadow: var(--shadow-lg);
  animation: up .22s ease-out;
}
@keyframes up { from { transform: translateY(18%); opacity: .6; } to { transform: none; opacity: 1; } }
.sheet-grip {
  width: 42px; height: 4px; border-radius: 4px;
  background: var(--line); margin: 4px auto 12px;
}
.sheet h3 { margin: 0 0 10px; font-size: 1.05rem; }
.sheet-info {
  margin: 0 0 14px;
  font-size: .84rem;
  color: var(--muted);
  background: var(--bg);
  border-radius: 12px;
  padding: 10px 12px;
}
.sheet-count {
  margin: 12px 0 0;
  font-size: .82rem;
  font-weight: 650;
  color: var(--blue-dark);
  text-align: center;
}
.sheet-body { margin-bottom: 14px; }

.tablewrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: .8rem; }
th, td {
  border: 1px solid var(--line);
  padding: 4px 7px;
  text-align: center;
  white-space: nowrap;
}
th { background: var(--bg); font-weight: 700; }
td.head, th.head { text-align: left; font-weight: 700; background: var(--bg); }

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(96px + var(--safe-b));
  transform: translateX(-50%);
  z-index: 80;
  background: var(--navy);
  color: #fff;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: .9rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  max-width: 90vw;
  text-align: center;
  animation: up .2s ease-out;
}
.toast.bad { background: var(--danger); }
.toast.good { background: #1c7a37; }

/* ------------------------------------------------------------------ admin */

.content.wide { max-width: 1100px; }

.stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
  margin-bottom: 10px;
}
@media (min-width: 620px) { .stats { grid-template-columns: repeat(4, 1fr); } }

.stat {
  background: var(--card);
  border-radius: 14px;
  box-shadow: var(--shadow);
  padding: 9px 12px;
}
.stat b { display: block; font-size: 1.15rem; letter-spacing: -.02em; line-height: 1.2; }
.stat span { font-size: .72rem; color: var(--muted); }

.actions { display: flex; flex-wrap: wrap; gap: 6px; padding: 8px; }
.actions .btn { flex: 1 1 calc(50% - 4px); text-align: center; text-decoration: none; font-size: .84rem; padding: 9px 10px; }

.tabs { display: grid; grid-template-columns: 1fr 1fr; gap: 5px; margin-bottom: 10px; }
.tab {
  flex: 1;
  font: inherit;
  font-size: .82rem;
  font-weight: 650;
  border: none;
  border-radius: 11px;
  padding: 8px 6px;
  background: var(--card);
  color: var(--muted);
  box-shadow: var(--shadow);
  cursor: pointer;
}
.tab.on { background: var(--navy); color: #fff; }

.pivot-name { text-align: left; white-space: nowrap; position: sticky; left: 0;
  background: var(--card); box-shadow: 1px 0 0 var(--line); }
td.zero { color: var(--muted); opacity: .38; }
td.hot  { font-weight: 800; color: var(--blue-dark); background: rgba(47, 143, 208, .08); }
@media (prefers-color-scheme: dark) { td.hot { color: #6cbcf0; } }
tfoot td, tr.total td { font-weight: 800; background: var(--bg); }

.order-row { display: flex; align-items: flex-start; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.order-row:last-child { border-bottom: none; }
.order-row .who { flex: 1; min-width: 0; }
.order-row .who b { display: block; font-size: .92rem; }
.order-row .who small { color: var(--muted); font-size: .74rem; }
.order-row .what { margin: 2px 0 0; font-size: .8rem; color: var(--muted); }
.order-row .what b { display: inline; font-size: inherit; color: var(--text); }
.order-row .val { text-align: right; font-weight: 700; white-space: nowrap; font-size: .88rem; }

.tag {
  display: inline-block;
  background: var(--danger);
  color: #fff;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .04em;
  border-radius: 6px;
  padding: 2px 6px;
  margin-left: 6px;
  vertical-align: middle;
}

.phones { display: flex; flex-wrap: wrap; gap: 8px; }
.phones { gap: 6px; }
.sheet-actions { display: flex; gap: 8px; }
.sheet-actions .btn { flex: 1; }
.roster-row { display: flex; align-items: center; gap: 8px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.roster-row:last-child { border-bottom: none; }
.roster-row .who { flex: 1; min-width: 0; }
.roster-row .who b { display: block; font-size: .92rem; }
.roster-row .who small { display: block; color: var(--muted); font-size: .74rem; }
.roster-row .acts { display: flex; gap: 6px; flex: none; }
.roster-row .acts button { font-size: .76rem; padding: 6px 9px; border-radius: 9px;
  border: 1.5px solid var(--line); background: var(--card); color: var(--muted); cursor: pointer; font-family: inherit; }
.roster-row .acts .edit { color: var(--blue-dark); }
.roster-row .acts .del { color: var(--danger); }
.dot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--green); margin-right: 5px; }
.dot.off { background: var(--line); }
.phones a {
  background: var(--bg);
  border: 1.5px solid var(--line);
  border-radius: 10px;
  padding: 8px 11px;
  font-size: .88rem;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
}

.icon-btn {
  font: inherit;
  font-size: .8rem;
  background: none;
  border: 1.5px solid var(--line);
  color: var(--danger);
  border-radius: 9px;
  padding: 5px 9px;
  cursor: pointer;
}

@media print {
  .topbar, .actions, .tabs, .icon-btn, .banner { display: none !important; }
  .tabpane { display: block !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #ccc; }
}
