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

:root {
  --blue:    #6b5ed4;
  --blue-d:  #5548b0;
  --green:   #1e8e3e;
  --red:     #b85050;
  --orange:  #f29900;
  --bg:      #f1f3f4;
  --surface: #ffffff;
  --text:    #202124;
  --muted:   #5f6368;
  --border:  #dadce0;
  --radius:  12px;
  --nav-h:   64px;
  --head-h:  56px;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100dvh;
  overscroll-behavior: none;
}

/* ── Top Header ───────────────────────────────────────────────────────────── */
.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--head-h);
  background: var(--blue);
  color: #fff;
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,.25);
}
.header h1 { font-size: 1.1rem; font-weight: 600; flex: 1; }
.header .icon { display: flex; align-items: center; flex-shrink: 0; }

/* ── Bottom Nav ───────────────────────────────────────────────────────────── */
.bottom-nav {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: var(--nav-h);
  background: var(--surface);
  border-top: 1px solid var(--border);
  display: flex;
  z-index: 100;
  box-shadow: 0 -2px 8px rgba(0,0,0,.08);
}
.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  text-decoration: none;
  color: var(--muted);
  font-size: .72rem;
  font-weight: 500;
  transition: color .15s;
  -webkit-tap-highlight-color: transparent;
}
.nav-item.active { color: var(--blue); }
.nav-item .ni { display: flex; align-items: center; justify-content: center; width: 24px; height: 24px; }

/* ── Main Content ─────────────────────────────────────────────────────────── */
.main {
  padding: calc(var(--head-h) + 12px) 12px calc(var(--nav-h) + 12px);
  min-height: 100dvh;
}

/* ── Search Bar ───────────────────────────────────────────────────────────── */
.search-wrap {
  position: sticky;
  top: var(--head-h);
  background: var(--bg);
  padding: 10px 0 8px;
  z-index: 50;
}
.search-box {
  width: 100%;
  padding: 12px 16px 12px 44px;
  border: 1.5px solid var(--border);
  border-radius: 100px;
  font-size: 1rem;
  background: var(--surface);
  outline: none;
  transition: border-color .2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24' fill='none' stroke='%235f6368' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 14px center;
}
.search-box:focus { border-color: var(--blue); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card-list { display: flex; flex-direction: column; gap: 10px; }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
  display: flex;
  align-items: center;
  gap: 12px;
  transition: box-shadow .15s;
}
.card:active { box-shadow: 0 3px 10px rgba(0,0,0,.15); }

.card-avatar {
  width: 46px; height: 46px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 1.1rem;
  flex-shrink: 0;
}

.card-info { flex: 1; min-width: 0; }
.card-name { font-weight: 600; font-size: 1rem; }
.card-sub  { font-size: .82rem; color: var(--muted); margin-top: 2px;
             white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-badge-row { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 5px; }
.badge {
  font-size: .7rem; padding: 2px 8px;
  background: #eeeafb; color: var(--blue);
  border-radius: 100px; font-weight: 500;
}

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px;
  padding: 10px 20px;
  border: none; border-radius: 100px;
  font-size: .9rem; font-weight: 600;
  cursor: pointer;
  transition: opacity .15s, transform .1s;
  -webkit-tap-highlight-color: transparent;
}
.btn:active { opacity: .85; transform: scale(.97); }
.btn-primary  { background: var(--blue);  color: #fff; }
.btn-success  { background: var(--green); color: #fff; }
.btn-danger   { background: var(--red);   color: #fff; }
.btn-ghost    { background: transparent; color: var(--blue); border: 1.5px solid var(--blue); }
.btn-icon     { padding: 10px; border-radius: 50%; }
.btn-sm       { padding: 7px 14px; font-size: .82rem; }
.btn-full     { width: 100%; }
.btn:disabled { opacity: .5; pointer-events: none; }

/* ── FAB ────────────────────────────────────────────────────────────────── */
.fab {
  position: fixed;
  right: 18px;
  bottom: calc(var(--nav-h) + 14px);
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(107,94,212,.40);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  z-index: 90;
  transition: transform .15s, box-shadow .15s;
  -webkit-tap-highlight-color: transparent;
}
.fab:active { transform: scale(.92); }

/* ── Modal / Drawer ──────────────────────────────────────────────────────── */
.modal-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 200;
  align-items: flex-end;
}
.modal-overlay.open { display: flex; }

.modal {
  background: var(--surface);
  border-radius: 20px 20px 0 0;
  padding: 20px 16px 32px;
  width: 100%;
  max-height: 92dvh;
  overflow-y: auto;
  animation: slideUp .25s ease;
}
@keyframes slideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.modal-handle {
  width: 40px; height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin: 0 auto 18px;
}
.modal-title {
  font-size: 1.15rem; font-weight: 700;
  margin-bottom: 18px;
}

/* ── Forms ───────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-label { display: block; font-size: .82rem; font-weight: 600; color: var(--muted); margin-bottom: 5px; }
.form-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border);
  border-radius: 10px;
  font-size: 1rem;
  outline: none;
  transition: border-color .2s;
  background: var(--surface);
}
.form-input:focus { border-color: var(--blue); }

/* ── Workshop dynamic fields ─────────────────────────────────────────────── */
.ws-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 8px; }
.ws-row  { display: flex; gap: 8px; align-items: center; }
.ws-row .form-input { flex: 1; }
.ws-row .btn-rm {
  flex-shrink: 0;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: #f5e5e5;
  color: var(--red);
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.add-ws-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 12px;
  background: #eeeafb;
  color: var(--blue);
  border: none; border-radius: 100px;
  font-size: .88rem; font-weight: 600;
  cursor: pointer;
}

/* ── Print button in card ────────────────────────────────────────────────── */
.print-btn {
  flex-shrink: 0;
  width: 44px; height: 44px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  border: none;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background .15s;
  -webkit-tap-highlight-color: transparent;
}
.print-btn:active  { background: var(--blue-d); }
.print-btn.success { background: var(--green); }
.print-btn.error   { background: var(--red); }
.print-btn.loading { animation: pulse 1s infinite; }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: .5; } }

/* ── Toast ───────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: calc(var(--nav-h) + 12px);
  left: 50%; transform: translateX(-50%);
  background: #3c4043;
  color: #fff;
  padding: 10px 20px;
  border-radius: 100px;
  font-size: .88rem;
  white-space: nowrap;
  z-index: 300;
  pointer-events: none;
  opacity: 0;
  transition: opacity .2s;
}
.toast.show { opacity: 1; }
.toast.ok  { background: var(--green); }
.toast.err { background: var(--red); }

/* ── Settings ────────────────────────────────────────────────────────────── */
.settings-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 16px;
  margin-bottom: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.settings-card h2 { font-size: .95rem; font-weight: 700; color: var(--muted); margin-bottom: 14px; text-transform: uppercase; letter-spacing: .04em; }

/* ── Empty state ─────────────────────────────────────────────────────────── */
.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
}
.empty .empty-icon { font-size: 3rem; margin-bottom: 12px; }
.empty p { font-size: .95rem; }

/* ── Divider ─────────────────────────────────────────────────────────────── */
.divider { height: 1px; background: var(--border); margin: 14px 0; }

/* ── Confirm overlay ─────────────────────────────────────────────────────── */
.confirm-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.5);
  z-index: 300;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.confirm-overlay.open { display: flex; }
.confirm-box {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 320px;
  box-shadow: 0 8px 32px rgba(0,0,0,.2);
}
.confirm-box h3 { font-size: 1.05rem; margin-bottom: 8px; }
.confirm-box p  { font-size: .9rem; color: var(--muted); margin-bottom: 20px; }
.confirm-box .btn-row { display: flex; gap: 10px; }
.confirm-box .btn-row .btn { flex: 1; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 4px; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }
