/* ==========================================================================
   Almera Mobile PWA — polished stylesheet
   Palette + typography lifted from almerateknik.com (dark theme).
   ========================================================================== */

/* Brand fonts — self-hosted, mirrored from almerateknik.com */
@font-face {
  font-family: "Neue Haas";
  src: url("assets/fonts/neueHaas-400.ttf") format("truetype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Neue Haas";
  src: url("assets/fonts/neueHaas-500.ttf") format("truetype");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Neue Haas";
  src: url("assets/fonts/neueHaas-700.ttf") format("truetype");
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Ethnocentric";
  src: url("assets/fonts/ethnocentric.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* Brand gold — primary hsl(41 72% 58%) on almerateknik.com dark theme */
  --gold:        #e1b047;
  --gold-soft:   #e7bf6a;
  --gold-deep:   #b8871e;
  --gold-glow:   rgba(225, 176, 71, 0.28);

  /* Deep ink navy — a richer, deeper take on the brand navy. Refined and
     premium, not the bright generic-SaaS blue. Gold accents sit cleanly
     on top. */
  --bg-0:        #0b1019;      /* page base (deep ink) */
  --bg-1:        #131a28;      /* panels */
  --bg-2:        #1a2434;      /* elevated surfaces */
  --bg-3:        #26303f;      /* hover */

  --line:        #2d3749;      /* refined navy hairline */
  --line-soft:   #1e2634;

  --text:        #f4f0e7;      /* warm bone — hsl(42 36% 93%) */
  --text-dim:    #cec5b6;      /* hsl(38 20% 76%) */
  --text-mute:   #9f927f;      /* hsl(37 14% 56%) */
  --text-on-gold:#0f1526;      /* site theme_color, deep navy */

  --ok:          #5ecf96;
  --warn:        #e8b947;
  --danger:      #f06450;

  /* `--brand-font` is for ALL caps section headings, labels, KPI values
     etc. Neue Haas is far more legible than Ethnocentric at small sizes
     and in long Turkish labels (Ş, Ç, Ü etc. are noisy in display fonts).
     `--display-font` keeps Ethnocentric for the actual brand wordmark
     where character shapes matter more than readability. */
  --brand-font:  "Neue Haas", -apple-system, BlinkMacSystemFont, "SF Pro Text",
                 "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --display-font: "Ethnocentric", "Neue Haas", system-ui, sans-serif;
  --sans-font:   "Neue Haas", -apple-system, BlinkMacSystemFont, "SF Pro Text",
                 "Segoe UI", Roboto, Helvetica, Arial, sans-serif;

  --r-sm: 8px;
  --r:    12px;
  --r-lg: 18px;

  --shadow-lg: 0 16px 48px rgba(0,0,0,0.55);
  --shadow:    0 8px 24px rgba(0,0,0,0.40);
  --shadow-sm: 0 2px 8px  rgba(0,0,0,0.30);

  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
  --safe-lr:  env(safe-area-inset-left, 0px);
}

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0; padding: 0;
  min-height: 100vh;
  background: var(--bg-0);
  color: var(--text);
  font-family: var(--sans-font);
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overscroll-behavior-y: none;
  text-rendering: optimizeLegibility;
}

/* Match almerateknik.com hero: cool navy glow top-left, warm gold glow top-right,
   deep well at the bottom — same radial-gradient stack the site uses. */
body {
  background:
    radial-gradient(ellipse at 0% -10%,
      rgba(41, 64, 122, 0.22) 0%, transparent 48%),
    radial-gradient(ellipse at 100% 0%,
      rgba(181, 140, 52, 0.14) 0%, transparent 40%),
    radial-gradient(ellipse at 50% 100%,
      rgba(10, 18, 40, 0.5) 0%, transparent 60%),
    var(--bg-0);
  background-attachment: fixed;
}

a { color: var(--gold-soft); text-decoration: none; }

/* Typography */
h1, h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: 0.01em;
  color: var(--text);
}

input, button, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

/* ==========================================================================
   App shell
   ========================================================================== */
.app {
  min-height: 100vh;
  display: flex; flex-direction: column;
  padding-top: var(--safe-top);
  padding-bottom: var(--safe-bot);
  padding-left: var(--safe-lr);
  padding-right: var(--safe-lr);
}
.app-main { display: flex; flex-direction: column; flex: 1; min-width: 0; }

/* ---- Sidebar (desktop) — hidden on mobile via [hidden] ---- */
.sidebar[hidden] { display: none !important; }
.sidebar {
  display: flex;
  flex-direction: column;
  width: 240px;
  flex-shrink: 0;
  padding: 20px 14px 18px;
  background: linear-gradient(180deg,
    rgba(12, 18, 34, 0.96) 0%,
    rgba(9, 14, 26, 0.96) 100%);
  border-right: 1px solid var(--line-soft);
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
.sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 4px 6px 22px; border-bottom: 1px solid var(--line-soft); margin-bottom: 14px; }
.sidebar-logo { width: 36px; height: 36px; object-fit: contain; flex-shrink: 0;
                filter: drop-shadow(0 1px 6px rgba(225,176,71,0.28)); }
.sidebar-brand-name { font-family: var(--display-font); font-size: 14px; letter-spacing: 0.22em;
                      color: var(--gold); line-height: 1; margin-bottom: 3px; }
.sidebar-brand-sub  { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase; color: var(--text-mute); }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px;
  border-radius: var(--r-sm);
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-decoration: none;
  transition: background 120ms ease, color 120ms ease;
}
.sidebar-nav a .nav-ico { width: 18px; height: 18px; flex-shrink: 0; opacity: 0.85; }
.sidebar-nav a:hover  { color: var(--text); background: var(--bg-2); }
.sidebar-nav a.active {
  color: var(--text-on-gold);
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  box-shadow: 0 4px 14px rgba(225,176,71,0.22);
}
.sidebar-nav .nav-section { font-size: 10px; letter-spacing: 0.22em; text-transform: uppercase;
                            color: var(--text-mute); padding: 14px 12px 6px; }

.sidebar-bottom { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line-soft);
                  display: flex; flex-direction: column; gap: 10px; }
.sidebar-user { font-size: 12px; color: var(--text-dim); padding: 0 4px; line-height: 1.3; }
.sidebar-user strong { color: var(--text); display: block; margin-bottom: 2px; }

/* ---- Desktop breakpoint ---- */
@media (min-width: 900px) {
  .app { flex-direction: row; align-items: stretch; }
  #top-bar { display: none !important; }
  .view-root { padding: 32px 40px 60px; max-width: 1200px; }
  .view { gap: 22px; }
  /* bigger panels on desktop */
  .glass-card, .detail-block { border-radius: var(--r-lg); }
}

/* ---- Hide the sidebar entirely on mobile ---- */
@media (max-width: 899px) {
  .sidebar { display: none !important; }
}

.top-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 12px 14px;
  background: linear-gradient(180deg,
    rgba(15, 21, 38, 0.95) 0%,
    rgba(15, 21, 38, 0.88) 100%);
  border-bottom: 1px solid var(--line-soft);
  position: sticky; top: 0; z-index: 10;
  box-shadow: 0 1px 0 rgba(225,176,71,0.08), 0 8px 20px rgba(0,0,0,0.35);
  /* Hard-clip to viewport so a too-wide pill can never bleed past the
     right edge — Bilal hit this with the new bell icon next to the
     sync badge on narrow iPhone widths. */
  overflow: hidden;
  min-width: 0;
}

.header-logo {
  width: 26px; height: 26px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 4px rgba(225, 176, 71, 0.25));
}

.top-title {
  margin: 0;
  font-family: var(--brand-font);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  flex: 1;
  min-width: 0;            /* allow shrink so right-side items always fit */
  text-align: center;
  text-shadow: 0 1px 10px rgba(225, 176, 71, 0.25);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.top-right {
  display: inline-flex; align-items: center; gap: 6px;
  flex-shrink: 0;          /* never let the right cluster shrink off-screen */
}
.top-right .icon-btn[hidden] { display: none !important; }
.top-right .icon-btn svg { display: block; }
.top-right .icon-btn { padding: 6px 8px; }    /* tighter than default 8/12 */
.top-right .badge { padding: 4px 9px; font-size: 11.5px; }

.icon-btn {
  background: transparent;
  color: var(--gold);
  border: 0;
  font-size: 22px;
  line-height: 1;
  padding: 8px 12px;
  border-radius: var(--r);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.icon-btn:active { background: rgba(225,176,71,0.14); }

/* Sync status pill */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text-dim);
  white-space: nowrap;
}
/* `display: inline-flex` above beats the user-agent's `[hidden]` rule and
   leaves an empty pill ghost in the top bar when an action isn't set.
   Force-hide here so [hidden] always wins. */
.badge[hidden] { display: none !important; }
.badge-ok   { color: var(--ok);    border-color: rgba(94,207,150,0.4); background: rgba(94,207,150,0.08); }
.badge-sync { color: var(--gold);  border-color: rgba(225,176,71,0.5); background: rgba(225,176,71,0.12);
              animation: pulse 1.4s ease-in-out infinite; }
.badge-warn { color: var(--warn);  border-color: rgba(232,185,71,0.5); background: rgba(232,185,71,0.10); }
.badge-danger{color: var(--danger);border-color: rgba(240,100,80,0.5); background: rgba(240,100,80,0.10); }
.badge-action {
  color: var(--gold);
  border-color: rgba(225,176,71,0.5);
  background: rgba(225,176,71,0.10);
  cursor: pointer;
  font-family: var(--brand-font);
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.badge-action:hover    { background: rgba(225,176,71,0.18); }
.badge-action:active   { transform: translateY(1px); }
.badge-action:disabled { opacity: 0.6; cursor: progress; }

@keyframes pulse {
  0%,100% { opacity: 0.55; }
  50%     { opacity: 1.0; }
}

/* ==========================================================================
   View root
   ========================================================================== */
.view-root {
  flex: 1;
  padding: 20px 18px 40px;
  max-width: 720px;
  width: 100%;
  margin: 0 auto;
}

.view {
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: fadeUp 280ms ease;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==========================================================================
   Login
   ========================================================================== */
.view-login {
  min-height: calc(100vh - var(--safe-top) - var(--safe-bot) - 40px);
  justify-content: center;
  gap: 28px;
}

.login-brand {
  text-align: center;
  margin: 20px 0 12px;
}

.login-logo {
  display: block;
  width: 128px;
  height: auto;
  max-height: 128px;
  margin: 0 auto 18px;
  object-fit: contain;
  filter:
    drop-shadow(0 12px 32px rgba(225, 176, 71, 0.30))
    drop-shadow(0 2px 8px rgba(0, 0, 0, 0.50));
}

.login-name {
  font-family: var(--brand-font);
  font-size: 28px;
  font-weight: 700;
  letter-spacing: 0.22em;
  color: var(--text);
  margin-bottom: 8px;
}

.login-sub {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.32em;
  text-transform: uppercase;
  color: var(--gold);
  opacity: 0.85;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 24px 20px;
  box-shadow: var(--shadow);
}

.api-hint {
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 12px;
  color: var(--text-mute);
}
.api-hint label { letter-spacing: 0.08em; text-transform: uppercase; font-weight: 600; }
.api-hint input {
  padding: 8px 10px; font-size: 12px; min-width: 0;
  background: var(--bg-0); border: 1px solid var(--line);
  color: var(--text-dim); border-radius: var(--r-sm);
}

/* ==========================================================================
   Fields / Forms
   ========================================================================== */
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > span,
.field > legend {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  padding: 0;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field input[type="url"],
.field textarea,
.field select,
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="url"],
textarea,
select {
  width: 100%;
  padding: 13px 14px;
  background: var(--bg-1);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r);
  font-size: 16px;        /* 16px prevents iOS zoom on focus */
  line-height: 1.35;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.02);
  transition: border-color 140ms ease, box-shadow 140ms ease, background 140ms ease;
  -webkit-appearance: none;
  appearance: none;
}

select {
  background-image:
    linear-gradient(45deg, transparent 50%, var(--gold) 50%),
    linear-gradient(135deg, var(--gold) 50%, transparent 50%);
  background-position:
    calc(100% - 22px) 50%,
    calc(100% - 15px) 50%;
  background-size: 7px 7px, 7px 7px;
  background-repeat: no-repeat;
  padding-right: 40px;
}

input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow), inset 0 1px 0 rgba(255,255,255,0.04);
  background: var(--bg-2);
}

textarea { resize: vertical; min-height: 80px; }

fieldset.field {
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 14px 16px;
  background: var(--bg-1);
  display: flex;
  flex-direction: column;
  gap: 12px;
}

fieldset.field > legend {
  padding: 0 8px;
  margin-left: 2px;
}

/* Time pickers */
.time-field .time-pickers {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  align-items: end;
  gap: 8px;
}
.time-unit {
  display: flex; flex-direction: column; gap: 4px;
}
.time-unit > span {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-dim);
  font-weight: 600;
}
.time-unit input {
  text-align: center;
  font-weight: 700;
  font-size: 22px;
  letter-spacing: 0.04em;
  padding: 12px 6px;
}
.time-colon {
  font-size: 26px;
  font-weight: 700;
  color: var(--gold);
  line-height: 48px;
  transform: translateY(-2px);
}
.time-hint {
  font-size: 12px;
  color: var(--text-mute);
  min-height: 1em;
  margin-top: 4px;
}
.time-hint.warn { color: var(--warn); }
.time-hint.err  { color: var(--danger); }

/* Parts list */
.parts-list { display: flex; flex-direction: column; gap: 8px; }

.part-row {
  display: grid;
  grid-template-columns: 1fr 72px auto;
  gap: 8px;
  align-items: center;
  padding: 8px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
}
.part-row select { padding: 10px 12px; font-size: 14px; }
.part-row input { padding: 10px 10px; font-size: 14px; text-align: center; }
.part-row .part-remove {
  background: transparent;
  color: var(--danger);
  border: 0;
  font-size: 22px;
  padding: 4px 8px;
  cursor: pointer;
  border-radius: var(--r-sm);
}
.part-row .part-remove:active { background: rgba(240,100,80,0.14); }

/* Record detail — keep machine-hero + grouped meta + content blocks visually
   distinct but tight. No big floating gaps between rows of the same kind. */
#record-detail {
  display: flex; flex-direction: column; gap: 8px;
}
#record-detail > dl {
  margin: 0;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
}
#record-detail > dl .detail-row {
  display: flex; flex-direction: column;
  gap: 2px;
  padding: 8px 14px;
  border-bottom: 1px solid var(--line-soft);
  border-right: 1px solid var(--line-soft);
  min-width: 0;
}
#record-detail > dl .detail-row:nth-child(2n) { border-right: 0; }
#record-detail > dl .detail-row:nth-last-child(-n+2) { border-bottom: 0; }
#record-detail > dl .detail-row:last-child:nth-child(odd) { border-right: 0; grid-column: 1 / -1; }
#record-detail > dl .detail-row dt {
  margin: 0;
  font-family: var(--brand-font);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-mute);
}
#record-detail > dl .detail-row dd {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}
.detail-block {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px 14px;
}
.detail-block h3 {
  font-family: var(--brand-font);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
  margin: 0 0 6px;
}
.detail-block p {
  margin: 0;
  font-size: 14px;
  color: var(--text);
  line-height: 1.45;
  white-space: pre-wrap;
}
@media (max-width: 560px) {
  #record-detail > dl { grid-template-columns: 1fr; }
  #record-detail > dl .detail-row {
    flex-direction: row;
    align-items: baseline;
    justify-content: space-between;
    gap: 12px;
    border-right: 0;
    padding: 8px 14px;
  }
  #record-detail > dl .detail-row dt { flex-shrink: 0; }
  #record-detail > dl .detail-row dd { text-align: right; min-width: 0; }
  #record-detail > dl .detail-row:nth-last-child(-n+2) { border-bottom: 1px solid var(--line-soft); }
  #record-detail > dl .detail-row:last-child { border-bottom: 0; }
}

/* Media grid */
.media-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.media-grid:empty { display: none; }
.media-thumb, .media-tile {
  position: relative;
  width: 100%;
  min-height: 140px;
  aspect-ratio: 1 / 1;
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-2);
  border: 1px solid var(--line);
  cursor: pointer;
}
.media-thumb > img, .media-thumb > video,
.media-tile > img, .media-tile > video {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.media-tile .tile-status {
  position: absolute; top: 6px; right: 6px;
  z-index: 2;
  width: 24px; height: 24px;
  border-radius: 50%;
  background: rgba(0,0,0,0.7);
  color: var(--ok);
  font-size: 12px;
  display: flex; align-items: center; justify-content: center;
}
.media-tile .tile-status.pending { color: var(--warn); }
.media-thumb .media-remove {
  position: absolute; top: 4px; right: 4px;
  width: 24px; height: 24px;
  border-radius: 12px;
  background: rgba(0,0,0,0.65);
  color: #fff; border: 0;
  font-size: 14px; line-height: 1;
  display: flex; align-items: center; justify-content: center;
}
.media-thumb .media-check {
  position: absolute; bottom: 4px; right: 4px;
  font-size: 11px;
  color: var(--ok);
  background: rgba(0,0,0,0.55);
  padding: 2px 6px;
  border-radius: 10px;
  font-weight: 700;
}
.media-add-btn {
  text-align: center;
  justify-content: center;
  border-style: dashed !important;
}

/* ==========================================================================
   Buttons
   ========================================================================== */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 8px;
  padding: 14px 18px;
  border-radius: var(--r);
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  min-height: 46px;       /* iOS tap target */
  transition: transform 120ms ease, box-shadow 140ms ease, background 140ms ease,
              border-color 140ms ease, color 140ms ease, opacity 140ms ease;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.btn[disabled], .btn:disabled {
  opacity: 0.45; cursor: not-allowed;
  transform: none !important;
}

.btn-primary {
  background: linear-gradient(180deg, var(--gold-soft) 0%, var(--gold) 55%, var(--gold-deep) 100%);
  color: var(--text-on-gold);
  border-color: transparent;
  box-shadow:
    0 6px 16px rgba(225, 176, 71, 0.35),
    inset 0 -2px 0 rgba(0,0,0,0.18),
    inset 0 1px 0 rgba(255,255,255,0.22);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.btn-primary:active {
  transform: translateY(1px);
  box-shadow:
    0 3px 8px rgba(225, 176, 71, 0.30),
    inset 0 -1px 0 rgba(0,0,0,0.18),
    inset 0 1px 0 rgba(255,255,255,0.12);
}

.btn-ghost {
  background: var(--bg-2);
  color: var(--text);
  border-color: var(--line);
}
.btn-ghost:active {
  background: var(--bg-3);
  border-color: var(--gold);
  color: var(--gold);
}

.btn-danger {
  color: var(--danger) !important;
  border-color: rgba(240, 100, 80, 0.25) !important;
  background: rgba(240, 100, 80, 0.05) !important;
}

.btn-small {
  padding: 9px 12px;
  font-size: 13px;
  min-height: 36px;
}

.btn-large {
  padding: 18px 20px;
  font-size: 16px;
  min-height: 56px;
  border-radius: var(--r-lg);
}

/* Form error / hint */
.form-error {
  background: rgba(240, 100, 80, 0.1);
  border: 1px solid rgba(240, 100, 80, 0.3);
  color: var(--danger);
  padding: 10px 12px;
  border-radius: var(--r);
  font-size: 13px;
  margin: 0;
}

/* ==========================================================================
   Home
   ========================================================================== */
.view-home { gap: 14px; }

.hello {
  padding: 20px;
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
}
.hello-label {
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-mute);
  margin-bottom: 4px;
  font-weight: 600;
}
.hello-name {
  font-size: 20px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}

.sync-meta {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  margin-top: 4px;
}
.sync-meta > span {
  font-size: 12px;
  color: var(--text-mute);
  letter-spacing: 0.02em;
}

/* ==========================================================================
   Records list
   ========================================================================== */
.view-records { gap: 10px; }

.records-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.record-card {
  padding: 16px;
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-0) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  cursor: pointer;
  transition: border-color 140ms ease, transform 140ms ease;
}
.record-card:active {
  transform: translateY(1px);
  border-color: var(--gold);
}
.record-card-header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 8px;
}
.record-card-title {
  font-size: 15px; font-weight: 700; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.record-card-status {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  padding: 3px 8px; border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--text-dim); background: var(--bg-2);
  font-weight: 700; flex-shrink: 0;
}
.record-card-status.status-resolved,
.record-card-status.status-signed_off {
  color: var(--ok); border-color: rgba(94,207,150,0.4); background: rgba(94,207,150,0.08);
}
.record-card-status.status-on_site,
.record-card-status.status-diagnosing {
  color: var(--gold); border-color: rgba(225,176,71,0.5); background: rgba(225,176,71,0.12);
}
.record-card-meta {
  font-size: 12px; color: var(--text-mute);
  display: flex; gap: 8px; flex-wrap: wrap;
}
.record-card-meta > span::before {
  content: "·"; margin-right: 8px; color: var(--gold);
}
.record-card-meta > span:first-child::before { content: ""; margin: 0; }

.empty-state {
  padding: 40px 20px;
  text-align: center;
  color: var(--text-mute);
  font-size: 14px;
}

/* Record detail */
.record-detail {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.record-detail-section {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
}
.record-detail-section h3 {
  font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold); font-weight: 700;
  margin: 0 0 10px;
}

/* ==========================================================================
   Toasts
   ========================================================================== */
.toast-root {
  position: fixed;
  top: calc(var(--safe-top) + 60px);
  left: 0; right: 0;
  padding: 0 16px;
  z-index: 100;
  pointer-events: none;
}
.toast {
  max-width: 520px;
  margin: 6px auto;
  padding: 12px 14px;
  border-radius: var(--r);
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  font-size: 14px;
  box-shadow: var(--shadow);
  animation: toastIn 200ms ease, toastOut 200ms ease 3.5s forwards;
  pointer-events: auto;
}
.toast.ok     { border-left: 3px solid var(--ok); }
.toast.err    { border-left: 3px solid var(--danger); }
.toast.info   { border-left: 3px solid var(--gold); }

@keyframes toastIn  { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to   { opacity: 0; transform: translateY(-8px); } }

/* ==========================================================================
   Misc
   ========================================================================== */
hr {
  border: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  margin: 10px 0;
}

::-webkit-scrollbar { width: 0; height: 0; }

/* Respect reduce-motion */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; }
}

/* Big screens (tablet / iPad) */
@media (min-width: 600px) {
  .view-root { padding: 28px 24px 60px; }
  .media-grid { grid-template-columns: repeat(4, 1fr); }
}

/* ---- Media modal (tap-to-enlarge photo/video viewer) ---- */
.media-modal {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.media-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.88);
  backdrop-filter: blur(6px);
  cursor: pointer;
}
.media-modal-content {
  position: relative;
  max-width: min(100%, 1400px);
  max-height: 92vh;
  display: flex; align-items: center; justify-content: center;
}
.media-modal-content > * { max-width: 100%; max-height: 92vh; }
.media-modal-content img,
.media-modal-content video {
  display: block;
  max-width: 100%;
  max-height: 92vh;
  width: auto; height: auto;
  object-fit: contain;
  border-radius: 8px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.6);
}
.media-modal-close {
  position: absolute;
  top: 12px; right: 12px;
  z-index: 2;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(20, 22, 30, 0.85);
  color: var(--text, #f4f0e7);
  font-size: 24px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.media-modal-close:hover { background: rgba(40, 42, 50, 0.95); }

/* Admin edit/delete row in record detail */
.admin-actions { display: flex; gap: 12px; margin-top: 12px; flex-wrap: wrap; }
.admin-actions button { flex: 1 1 auto; min-width: 140px; }

/* Admin PDF-report button (record detail) */
.pdf-block { margin-top: 4px; }
.pdf-block button { width: 100%; }

/* Stock toolbar (admin stocks view) */
.stock-toolbar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.stock-toolbar .stock-search {
  flex: 1 1 240px;
  min-width: 200px;
  background: var(--bg-1);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  font-size: 14px;
}
.stock-toolbar .stock-search:focus { outline: none; border-color: var(--gold-deep); }
.stock-toolbar button { min-width: 160px; }
.stock-toolbar-count {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text-mute);
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--bg-2);
}
.stock-toolbar-note { color: var(--text-mute); font-size: 12px; line-height: 1.4; flex: 1 1 100%; }
@media (max-width: 560px) {
  .stock-toolbar { gap: 8px; }
  .stock-toolbar .stock-search { flex-basis: 100%; }
  .stock-toolbar button { width: 100%; min-width: 0; }
  .stock-toolbar-note { font-size: 11px; }
}
.stock-row.stock-row-readonly { cursor: default; }
.stock-row.stock-row-readonly:hover { background: var(--bg-2); /* no clickable affordance */ }

/* ==========================================================================
   Page head (admin pages + dashboard)
   ========================================================================== */
.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; flex-wrap: wrap;
}
.page-kicker {
  font-family: var(--brand-font);
  font-size: 10px; letter-spacing: 0.3em; text-transform: uppercase;
  color: var(--gold-deep); margin-bottom: 6px;
}
.page-title {
  font-family: var(--brand-font);
  font-size: 26px; font-weight: 700; letter-spacing: 0.08em;
  color: var(--gold); margin: 0; line-height: 1;
}
.page-sub { margin-top: 6px; color: var(--text-dim); font-size: 13px; }

/* ---- KPI row (premium: icon chip + delta pill + accent-glow number) ---- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}
@media (min-width: 700px) { .kpi-row { gap: 14px; } }
.kpi-card {
  position: relative; overflow: hidden;
  padding: 16px 16px 15px;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  min-width: 0;
  transition: transform 180ms ease, border-color 180ms ease, box-shadow 180ms ease;
}
/* faint accent glow bleeding from the top-right corner */
.kpi-card::before {
  content: ""; position: absolute; top: -40px; right: -30px;
  width: 120px; height: 120px; border-radius: 50%;
  background: radial-gradient(circle, var(--kpi-glow, transparent), transparent 70%);
  opacity: 0.6; pointer-events: none;
}
/* hairline top highlight */
.kpi-card::after {
  content: ""; position: absolute; top: 0; left: 14px; right: 14px; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.10), transparent);
}
.kpi-card:hover {
  transform: translateY(-3px);
  border-color: var(--kpi-line, var(--line-soft));
  box-shadow: 0 14px 34px rgba(0,0,0,0.40);
}
.kpi-top {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 14px;
}
.kpi-ico {
  width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--kpi-soft, rgba(255,255,255,0.04));
  border: 1px solid var(--kpi-soft, transparent);
  color: var(--kpi-accent, var(--text-mute));
}
.kpi-ico svg { width: 16px; height: 16px; }
.kpi-delta {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--kpi-accent, var(--text-mute));
  background: var(--kpi-soft, rgba(255,255,255,0.05));
  padding: 3px 8px; border-radius: 999px;
}
.kpi-value {
  font-family: var(--brand-font);
  font-size: 33px; font-weight: 700; letter-spacing: -0.01em;
  line-height: 1; color: var(--kpi-accent, var(--text));
  font-variant-numeric: tabular-nums;
}
.kpi-label {
  font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-mute); margin-top: 7px; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
/* Mobile: 2x2 grid so each KPI is wide enough for its full label, and the
   card is more compact (no hollow gap under the number). */
@media (max-width: 620px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .kpi-card { padding: 13px 14px 12px; border-radius: var(--r); }
  .kpi-top { margin-bottom: 12px; }
  .kpi-value { font-size: 27px; }
  .kpi-label { font-size: 9.5px; letter-spacing: 0.14em; white-space: normal; }
}
.kpi-gold   { --kpi-accent: var(--gold);   --kpi-glow: rgba(225,176,71,0.30); --kpi-soft: rgba(225,176,71,0.12); --kpi-line: var(--gold-deep); }
.kpi-ok     { --kpi-accent: var(--ok);     --kpi-glow: rgba(94,207,150,0.26); --kpi-soft: rgba(94,207,150,0.12); --kpi-line: rgba(94,207,150,0.5); }
.kpi-warn   { --kpi-accent: var(--warn);   --kpi-glow: rgba(232,185,71,0.24); --kpi-soft: rgba(232,185,71,0.12); --kpi-line: rgba(232,185,71,0.5); }
.kpi-danger { --kpi-accent: var(--danger); --kpi-glow: rgba(240,100,80,0.26); --kpi-soft: rgba(240,100,80,0.12); --kpi-line: rgba(240,100,80,0.5); }
.kpi-mute   { --kpi-accent: var(--text-dim); --kpi-glow: transparent; --kpi-soft: rgba(255,255,255,0.05); --kpi-line: var(--line-soft); }

/* ---- Dashboard 2-column grid ---- */
.dash-grid {
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) { .dash-grid { grid-template-columns: 1.3fr 1fr; } }

.dash-card {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.dash-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
}
.dash-card-head h2 {
  display: flex; align-items: center; gap: 9px;
  font-family: var(--brand-font);
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold); margin: 0; font-weight: 700;
}
.dash-card-head h2::before {
  content: ""; width: 4px; height: 14px; border-radius: 2px;
  background: linear-gradient(var(--gold), var(--gold-deep));
}
.dash-card-head a { font-size: 12px; color: var(--text-mute); }
.dash-card-head a:hover { color: var(--gold); }
.dash-list { padding: 6px 0; }
.dash-row {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: inherit; text-decoration: none;
  transition: background 120ms ease;
}
.dash-row:last-child { border-bottom: 0; }
.dash-row:hover { background: var(--bg-2); }
.dash-row-main { flex: 1; min-width: 0; }
.dash-row-title {
  font-size: 13px; color: var(--text); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash-row-sub {
  font-size: 11px; color: var(--text-dim); margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dash-row-sub.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.dash-row-meta { text-align: right; flex-shrink: 0; }
.dash-row-date { font-size: 11px; color: var(--text-dim); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.dash-row-eng  { font-size: 11px; color: var(--gold-soft); margin-top: 2px; }

/* Most-used parts rows: small part photo + gold "N adet" badge */
.dash-row-thumb {
  width: 40px; height: 40px;
  border-radius: var(--r-sm);
  object-fit: cover;
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  flex-shrink: 0;
}
.dash-used-badge {
  display: inline-flex; align-items: baseline; gap: 4px;
  font-family: var(--brand-font);
  font-size: 17px; font-weight: 700;
  color: var(--gold);
  line-height: 1;
}
.dash-used-unit {
  font-family: var(--sans-font);
  font-size: 10px; font-weight: 600;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}
/* Rank number on the most-used rows; top 3 are gold. */
.dash-rank {
  width: 18px; flex-shrink: 0; text-align: center;
  font-size: 12px; font-weight: 800; color: var(--text-mute);
  font-variant-numeric: tabular-nums;
}
.dash-rank.top { color: var(--gold); }

.stock-chip {
  display: inline-block; min-width: 32px; padding: 3px 10px;
  font-weight: 700; font-size: 12px;
  border-radius: 999px;
  background: rgba(94, 207, 150, 0.12); color: var(--ok);
  border: 1px solid rgba(94, 207, 150, 0.3);
}
.stock-chip.low  { color: var(--warn);   background: rgba(232,185,71,0.12); border-color: rgba(232,185,71,0.3); }
.stock-chip.zero { color: var(--danger); background: rgba(240,100,80,0.12); border-color: rgba(240,100,80,0.3); }

.empty { padding: 18px 16px; color: var(--text-mute); font-size: 13px; text-align: center; }

/* ---- Filter bar (admin services) ---- */
.filter-bar {
  display: grid; gap: 8px;
  grid-template-columns: 1fr 1fr;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 10px;
}
@media (min-width: 700px) {
  .filter-bar { grid-template-columns: 2fr 1fr 1fr 1fr auto; }
}
.filter-input, .filter-select, .filter-date {
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-size: 13px;
  outline: none;
  transition: border-color 120ms ease, box-shadow 120ms ease;
}
.filter-input:focus, .filter-select:focus, .filter-date:focus {
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 3px rgba(225, 176, 71, 0.18);
}
.load-more { display: flex; justify-content: center; margin-top: 10px; }

/* ---- Home tiles (engineer landing page) ---- */
.home-tiles {
  display: grid; gap: 14px;
  grid-template-columns: 1fr;
}
@media (min-width: 600px) { .home-tiles { grid-template-columns: 1fr 1fr; } }
.home-tile {
  display: flex; align-items: center; gap: 18px;
  padding: 22px 20px;
  text-align: left;
  border-radius: var(--r-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  color: var(--text);
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
  font-family: inherit;
}
.home-tile:hover {
  transform: translateY(-2px);
  border-color: var(--gold-deep);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.home-tile-ico { width: 40px; height: 40px; color: var(--gold); flex-shrink: 0; }
.home-tile-title {
  font-family: var(--brand-font);
  font-size: 14px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text); margin-bottom: 4px;
}
.home-tile-sub { font-size: 12px; color: var(--text-dim); letter-spacing: 0.04em; }

.home-tile-primary {
  border-color: rgba(225, 176, 71, 0.38);
  background: linear-gradient(180deg, rgba(225,176,71,0.12), rgba(225,176,71,0.04));
  box-shadow: 0 0 0 1px rgba(225,176,71,0.08) inset;
}
.home-tile-primary .home-tile-title { color: var(--gold); }
.home-tile-primary:hover { border-color: var(--gold); box-shadow: 0 10px 30px rgba(225,176,71,0.18); }

/* ---- Record card polish ---- */
.record-card {
  position: relative;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold-deep);
  border-radius: var(--r);
  padding: 14px 16px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.record-card:hover {
  transform: translateY(-1px);
  border-color: var(--line-soft);
  border-left-color: var(--gold);
  box-shadow: 0 6px 22px rgba(0,0,0,0.35);
}
.record-head { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.record-cust { font-size: 14px; font-weight: 600; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.record-date { font-size: 11px; color: var(--text-mute); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; flex-shrink: 0; }
.record-serial { font-size: 11px; color: var(--gold-soft); letter-spacing: 0.08em; }
.record-sub {
  font-size: 12px; color: var(--text-dim); line-height: 1.4;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.record-footer { display: flex; align-items: center; gap: 10px; margin-top: 4px; flex-wrap: wrap; }
.record-status { font-size: 11px; color: var(--text-dim); letter-spacing: 0.06em; text-transform: uppercase; }
.record-engineer { font-size: 11px; color: var(--gold); letter-spacing: 0.02em; }
.record-footer .status-pill { margin-left: auto; font-size: 10px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); }
.status-pill.sync-ok      { color: var(--ok);     border-color: rgba(94,207,150,0.4); background: rgba(94,207,150,0.08); }
.status-pill.sync-error   { color: var(--danger); border-color: rgba(240,100,80,0.4); background: rgba(240,100,80,0.10); }
.status-pill.sync-pending { color: var(--warn);   border-color: rgba(232,185,71,0.4); background: rgba(232,185,71,0.10); }

.records-list { display: flex; flex-direction: column; gap: 10px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---- Required-field asterisk ---- */
.field .req { color: var(--gold); font-style: normal; margin-left: 4px; }

/* ---- Machine tile grid (new-service form) ---- */
.machine-field { padding: 12px; }
.machine-empty {
  padding: 28px 10px; text-align: center;
  color: var(--text-mute); font-size: 13px; margin: 0;
  border: 1px dashed var(--line); border-radius: var(--r-sm);
  background: rgba(0,0,0,0.15);
}
.machine-tiles {
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
.machine-tile {
  display: flex; flex-direction: column;
  padding: 10px;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  color: var(--text);
  cursor: pointer;
  text-align: center;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease, box-shadow 140ms ease;
  font-family: inherit;
}
.machine-tile:hover { transform: translateY(-2px); border-color: var(--gold-deep); background: var(--bg-3); }
.machine-tile.selected {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(225,176,71,0.14), rgba(225,176,71,0.05));
  box-shadow: 0 0 0 2px rgba(225,176,71,0.25) inset, 0 6px 18px rgba(225,176,71,0.15);
}
.machine-tile img {
  width: 100%; height: 100px;
  object-fit: contain;
  background: var(--bg-0);
  border-radius: var(--r-sm);
  margin-bottom: 8px;
  flex-shrink: 0;
}
.machine-tile-model {
  font-family: var(--brand-font);
  font-size: 12px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--gold);
}
.machine-tile-serial {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px; color: var(--text-dim);
  margin-top: 2px;
}

/* ---- Co-engineer chips ---- */
.co-engineer-chips { display: flex; flex-wrap: wrap; gap: 8px; padding: 8px 0 4px; }
.co-empty { color: var(--text-mute); font-size: 12px; padding: 6px 2px; }
.co-chip {
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  color: var(--text-dim);
  font-size: 12px;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
  font-family: inherit;
}
.co-chip:hover { color: var(--text); background: var(--bg-3); }
.co-chip.selected {
  background: linear-gradient(180deg, var(--gold), var(--gold-deep));
  color: var(--text-on-gold);
  border-color: var(--gold);
  font-weight: 700;
}

/* ---- Part tile stock badge ---- */
.part-tile-stock {
  margin: auto 8px 10px;
  align-self: center;
  font-size: 10px;
  padding: 3px 10px;
  flex-shrink: 0;
}
.part-tile-empty { opacity: 0.55; }
.part-tile-empty:hover { transform: none; border-color: var(--line-soft); background: var(--bg-2); cursor: not-allowed; }

/* ---- Parts-picker modal (Browse parts) ---- */
.parts-picker {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.parts-picker-backdrop {
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(6px);
}
.parts-picker-panel {
  position: relative;
  width: min(100%, 900px);
  max-height: 88vh;
  display: flex; flex-direction: column;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.parts-picker-head {
  display: flex; align-items: center;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
}
.parts-picker-head h2 {
  margin: 0;
  font-family: var(--brand-font);
  font-size: 13px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  flex: 1;
}
.parts-picker-close {
  border: 0;
  background: transparent;
  color: var(--text-dim);
  font-size: 24px; line-height: 1;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 6px;
}
.parts-picker-close:hover { color: var(--text); background: var(--bg-3); }

.parts-picker-search {
  margin: 12px 16px 8px;
  padding: 10px 12px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text);
  font-size: 14px;
  outline: none;
}
.parts-picker-search:focus {
  border-color: var(--gold-deep);
  box-shadow: 0 0 0 3px rgba(225, 176, 71, 0.18);
}

.parts-picker-grid {
  flex: 1;
  overflow-y: auto;
  padding: 10px 16px 16px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 10px;
}

.part-tile {
  display: flex; flex-direction: column;
  padding: 0;
  background: var(--bg-2);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  cursor: pointer;
  color: var(--text);
  transition: transform 120ms ease, border-color 120ms ease, background 120ms ease;
  overflow: hidden;
  text-align: center;
  min-height: 240px;
  font-family: inherit;
}
.part-tile:hover {
  transform: translateY(-2px);
  border-color: var(--gold-deep);
  background: var(--bg-3);
}
.part-tile img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
  flex-shrink: 0;
  background: var(--bg-0);
  border-bottom: 1px solid var(--line-soft);
}
.part-tile-name {
  padding: 6px 8px 2px;
  font-size: 11px;
  color: var(--text);
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  flex-shrink: 0;
  min-height: 28px;
}
.part-tile-sku {
  padding: 0 8px 8px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 10px;
  color: var(--text-mute);
  flex-shrink: 0;
}

@media (min-width: 600px) {
  .parts-picker-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
}

/* ---- Machine preview card (new-service + record detail) ---- */
.machine-preview[hidden] { display: none !important; }
.machine-preview {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  box-shadow: var(--shadow-sm);
}
.machine-preview-img {
  width: 72px; height: 72px;
  object-fit: contain;
  background: rgba(225, 176, 71, 0.06);
  border-radius: var(--r-sm);
  border: 1px solid var(--line-soft);
  padding: 4px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
}
.machine-preview-meta { display: flex; flex-direction: column; gap: 4px; }
.machine-preview-model {
  font-family: var(--brand-font);
  font-size: 15px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}
.machine-preview-serial {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
}

/* ==========================================================================
   Admin CRUD: customers + machines (cards, filter bar, form modal)
   ========================================================================== */

/* Simplified filter bar (search + reset + primary button) for CRUD screens. */
.filter-bar-simple {
  grid-template-columns: 1fr auto auto;
}
@media (min-width: 700px) {
  .filter-bar-simple { grid-template-columns: 2fr auto auto auto; }
}

/* Customer card — same gold left-border lift as record-card. */
.customer-card {
  position: relative;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold-deep);
  border-radius: var(--r);
  padding: 14px 16px;
  cursor: pointer;
  display: flex; flex-direction: column; gap: 6px;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.customer-card:hover {
  transform: translateY(-1px);
  border-color: var(--line-soft);
  border-left-color: var(--gold);
  box-shadow: 0 6px 22px rgba(0,0,0,0.35);
}

/* Machine card — adds a model thumbnail on the left. */
.machine-card-admin {
  position: relative;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold-deep);
  border-radius: var(--r);
  padding: 12px 14px;
  cursor: pointer;
  display: flex; align-items: center; gap: 14px;
  transition: transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.machine-svc-count,
.customer-count-pill {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--gold);
  background: rgba(225,176,71,0.12);
  border: 1px solid rgba(225,176,71,0.32);
  padding: 3px 8px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
}
.customer-counts { display: inline-flex; gap: 6px; flex-wrap: nowrap; }

/* Service detail — Kullanılan parçalar */
.parts-used-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, 160px);
  gap: 10px;
  justify-content: start;
}
.part-used-card {
  display: flex; flex-direction: column;
  width: 160px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.part-used-img {
  width: 100%;
  /* iOS Safari < 15 doesn't honour aspect-ratio. Force a height fallback. */
  height: 140px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line-soft);
  display: block;
}
@supports (aspect-ratio: 1 / 1) {
  .part-used-img { height: auto; }
}
.part-used-body {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  padding: 8px 10px 10px;
  min-width: 0;
}
.part-used-text { flex: 1; min-width: 0; }
.part-used-name { color: var(--text); font-size: 13px; font-weight: 600; line-height: 1.3;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-used-sku { color: var(--text-dim); font-size: 11px; margin-top: 2px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.part-used-qty {
  font-family: var(--brand-font, monospace);
  color: var(--gold);
  font-size: 15px; font-weight: 600;
  flex-shrink: 0;
}
@media (max-width: 560px) {
  .parts-used-list { grid-template-columns: repeat(auto-fill, 140px); gap: 8px; }
  .part-used-card { width: 140px; }
}
.customer-count-pill.customer-count-svc {
  color: var(--text-dim); background: rgba(255,255,255,0.04); border-color: var(--line);
}
.machine-card-admin:hover {
  transform: translateY(-1px);
  border-color: var(--line-soft);
  border-left-color: var(--gold);
  box-shadow: 0 6px 22px rgba(0,0,0,0.35);
}
.machine-card-img {
  width: 72px; height: 72px;
  object-fit: contain;
  background: rgba(225, 176, 71, 0.06);
  border-radius: var(--r-sm);
  border: 1px solid var(--line-soft);
  padding: 4px;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 6px rgba(0,0,0,0.35));
}
.machine-card-body {
  flex: 1 1 auto;
  min-width: 0;
  display: flex; flex-direction: column; gap: 4px;
}

/* Form modal — create/edit screen for customers + machines.
   Same backdrop + centred panel pattern as .media-modal. */
.form-modal {
  position: fixed; inset: 0;
  z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  padding: 20px;
}
.form-modal-backdrop {
  position: absolute; inset: 0;
  background: rgba(9, 14, 26, 0.78);
  backdrop-filter: blur(4px);
}
.form-modal-panel {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: calc(100vh - 40px);
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.form-modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
}
.form-modal-title {
  margin: 0;
  font-family: var(--brand-font);
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}
.form-modal-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 4px 8px;
}
.form-modal-close:hover { color: var(--gold); }
.form-modal-form {
  padding: 16px;
  display: flex; flex-direction: column;
  gap: 14px;
  overflow-y: auto;
}
.form-modal-form .field { gap: 6px; }
.form-modal-actions {
  display: flex; gap: 10px; flex-wrap: wrap;
  justify-content: flex-end;
  padding-top: 6px;
  border-top: 1px solid var(--line-soft);
  margin-top: 4px;
  padding-top: 14px;
}
.form-modal-actions .form-modal-cancel { margin-right: auto; }
.form-modal-actions .form-modal-delete {
  background: rgba(240, 100, 80, 0.08);
  color: var(--danger);
  border: 1px solid rgba(240, 100, 80, 0.35);
}
.form-modal-actions .form-modal-delete:hover {
  background: rgba(240, 100, 80, 0.16);
  border-color: var(--danger);
}

@media (max-width: 560px) {
  .form-modal { padding: 0; }
  .form-modal-panel {
    max-width: 100%;
    max-height: 100vh;
    border-radius: 0;
    height: 100%;
  }
}

/* ==========================================================================
   WhatsApp paste block (new-service form)
   ========================================================================== */

/* ==========================================================================
   Admin detail pages (customer + machine)
   ========================================================================== */
.detail-head-actions { display: flex; gap: 8px; }
.detail-grid {
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .detail-grid { grid-template-columns: 1.5fr 1fr; }
}
.detail-section {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}
.detail-section-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line-soft);
  background: linear-gradient(180deg, var(--bg-2), var(--bg-1));
}
.detail-section-head h2 {
  font-family: var(--brand-font);
  font-size: 12px; letter-spacing: 0.22em; text-transform: uppercase;
  color: var(--gold); margin: 0; font-weight: 700;
}
.detail-count { font-size: 11px; color: var(--text-mute); letter-spacing: 0.04em; }

.detail-dl { margin: 0; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.detail-dl-row { display: grid; grid-template-columns: 80px 1fr; gap: 12px; align-items: baseline; }
.detail-dl-row dt { font-size: 10px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--text-mute); margin: 0; }
.detail-dl-row dd { margin: 0; font-size: 13px; color: var(--text); line-height: 1.4; word-break: break-word; }
.text-muted { color: var(--text-mute); font-style: italic; }

.detail-list { padding: 6px 0; }
.detail-list-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line-soft);
  color: inherit; text-decoration: none;
  transition: background 120ms ease;
}
.detail-list-row:last-child { border-bottom: 0; }
.detail-list-row:hover { background: var(--bg-2); }
.detail-list-img {
  width: 48px; height: 48px;
  object-fit: contain;
  background: var(--bg-0);
  border-radius: var(--r-sm);
  border: 1px solid var(--line-soft);
  flex-shrink: 0;
  padding: 4px;
}
.detail-list-main { flex: 1; min-width: 0; }
.detail-list-title {
  font-family: var(--brand-font);
  font-size: 12px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--gold);
}
.detail-list-sub { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
.detail-list-chev { color: var(--text-mute); font-size: 18px; opacity: 0.6; }

.machine-hero {
  display: flex; gap: 20px; padding: 18px;
  align-items: center;
}
@media (max-width: 600px) { .machine-hero { flex-direction: column; text-align: center; } }
.machine-hero-img {
  width: 200px; height: 200px;
  object-fit: contain;
  background: var(--bg-0);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
  padding: 10px;
  flex-shrink: 0;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.4));
}
@media (max-width: 600px) { .machine-hero-img { width: 140px; height: 140px; } }
.machine-hero-meta { flex: 1; display: flex; flex-direction: column; gap: 10px; }
.machine-hero-customer { font-size: 15px; font-weight: 600; color: var(--text); }
.customer-link { color: var(--gold); text-decoration: none; border-bottom: 1px dashed var(--gold-deep); }
.customer-link:hover { color: var(--gold-soft); }

.stat-row { display: flex; gap: 12px; flex-wrap: wrap; }
.stat-tile {
  flex: 1 1 160px;
  min-width: 140px;
  padding: 14px 16px;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line);
  border-left: 3px solid var(--line);
  border-radius: var(--r);
  display: flex; flex-direction: column; gap: 4px;
}
.stat-tile .kpi-value { font-family: var(--brand-font); font-size: 18px; letter-spacing: 0.04em; color: var(--text); line-height: 1.2; }
.stat-tile .kpi-label { font-size: 10px; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-mute); }
.stat-tile.kpi-gold   { border-left-color: var(--gold); }
.stat-tile.kpi-gold   .kpi-value { color: var(--gold); }

/* Inline edit icon on cards */
.customer-card, .machine-card-admin { position: relative; }
.inline-edit-btn {
  position: absolute;
  top: 10px; right: 10px;
  width: 28px; height: 28px;
  padding: 0;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text-mute);
  font-size: 13px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 140ms ease, color 120ms ease, border-color 120ms ease, background 120ms ease;
}
.customer-card:hover .inline-edit-btn,
.machine-card-admin:hover .inline-edit-btn,
.inline-edit-btn:focus-visible { opacity: 1; }
.inline-edit-btn:hover { color: var(--gold); border-color: var(--gold-deep); background: var(--bg-3); }

/* ==========================================================================
   Polish: empty states, skeletons, focus rings, micro-interactions
   ========================================================================== */
.empty-state {
  padding: 48px 18px;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px;
  color: var(--text-mute);
  text-align: center;
}
.empty-state-ico { width: 48px; height: 48px; opacity: 0.35; color: var(--gold); }
.empty-state h3 { font-size: 14px; font-weight: 600; color: var(--text-dim); margin: 4px 0 2px; letter-spacing: 0.02em; }
.empty-state p { font-size: 12px; color: var(--text-mute); margin: 0; max-width: 320px; }

/* Skeleton shimmer loaders */
@keyframes skeletonShimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton {
  background: linear-gradient(90deg, var(--bg-2) 0%, var(--bg-3) 50%, var(--bg-2) 100%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.4s linear infinite;
  border-radius: var(--r-sm);
}
.skeleton-text { height: 12px; margin: 6px 0; border-radius: 4px; }
.skeleton-card { height: 80px; margin-bottom: 10px; }
.skeleton-tile { aspect-ratio: 1/1; width: 100%; }

/* Focus-visible rings */
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--gold-soft);
  outline-offset: 2px;
  border-radius: inherit;
}

/* Active-press state for buttons + tiles */
.btn:active, .home-tile:active, .machine-tile:active, .part-tile:active, .customer-card:active, .machine-card-admin:active, .dash-row:active, .record-card:active {
  transform: translateY(1px) scale(0.996);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* Scrollbar styling */
.parts-picker-grid::-webkit-scrollbar,
.view-root::-webkit-scrollbar,
.sidebar::-webkit-scrollbar,
.form-modal-panel::-webkit-scrollbar {
  width: 8px; height: 8px;
}
.parts-picker-grid::-webkit-scrollbar-thumb,
.view-root::-webkit-scrollbar-thumb,
.sidebar::-webkit-scrollbar-thumb,
.form-modal-panel::-webkit-scrollbar-thumb {
  background: var(--bg-3);
  border-radius: 4px;
}
.parts-picker-grid::-webkit-scrollbar-thumb:hover,
.view-root::-webkit-scrollbar-thumb:hover,
.sidebar::-webkit-scrollbar-thumb:hover,
.form-modal-panel::-webkit-scrollbar-thumb:hover {
  background: var(--line);
}

/* Toast polish */
.toast {
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: toastIn 220ms ease-out;
}
@keyframes toastIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

/* Stocks — kanban-style card grid. Each part is a tile with a hero photo,
   a qty badge in the top-right corner of the photo, and a name + SKU
   underneath. Auto-fill columns so the layout adapts from phone (2 cols)
   to wide desktop (5+ cols) without media-query breakpoints. */
.stocks-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 14px;
  padding: 4px 0 24px;
}
.stock-card {
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  display: flex; flex-direction: column;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}
.stock-card:hover {
  border-color: var(--gold-deep);
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(0,0,0,0.35);
}
.stock-card-thumb {
  position: relative;
  width: 100%;
  /* `aspect-ratio` isn't honoured on iOS Safari < 15. Fall back to the
     padding-trick: 100% bottom padding on the parent gives a perfect
     square, and the absolutely-positioned image fills it. Modern browsers
     also see aspect-ratio and short-circuit the padding hack. */
  padding-bottom: 100%;
  aspect-ratio: 1 / 1;
  background: var(--bg-1);
  border-bottom: 1px solid var(--line-soft);
  overflow: hidden;
}
.stock-card-thumb img {
  position: absolute;
  inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
/* Browsers that support aspect-ratio: kill the padding so the box is
   sized by aspect-ratio alone (otherwise we'd end up double-tall). */
@supports (aspect-ratio: 1 / 1) {
  .stock-card-thumb { padding-bottom: 0; }
}
.stock-card-qty {
  position: absolute;
  top: 8px; right: 8px;
  min-width: 30px;
  padding: 4px 8px;
  border-radius: 999px;
  background: rgba(9, 14, 26, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(225, 176, 71, 0.4);
  color: var(--gold);
  font-family: var(--brand-font);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
  letter-spacing: 0.04em;
  line-height: 1;
}
.stock-card-low  .stock-card-qty {
  color: var(--warn);
  border-color: rgba(232, 185, 71, 0.55);
}
.stock-card-zero .stock-card-qty {
  color: var(--danger);
  border-color: rgba(240, 100, 80, 0.55);
  background: rgba(60, 18, 14, 0.85);
}

/* Usage badge — bottom-left counterpart to the qty badge, only shown when
   this part has ever been used in a service. Keeps the photo readable
   while making "how often do we burn through this?" answerable at a glance. */
.stock-card-uses {
  position: absolute;
  bottom: 8px; left: 8px;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px 3px 6px;
  border-radius: 999px;
  background: rgba(9, 14, 26, 0.85);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--text-dim);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  cursor: help;
}
.stock-card-uses svg { display: block; opacity: 0.7; }
@media (max-width: 560px) {
  .stock-card-uses { font-size: 10px; padding: 2px 7px 2px 5px; bottom: 6px; left: 6px; }
}
.stock-card-body {
  padding: 10px 12px 12px;
  display: flex; flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.stock-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-overflow: ellipsis;
  word-break: break-word;
}
.stock-card-sku {
  font-size: 11px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
/* Admin action row on each stock card: "+ Stok ekle" (opens the qty
   prompt) + edit pencil (opens the full item form). Manual deduct is
   intentionally absent — engineer service records auto-deduct on the
   server. Buttons swallow their click so the parent card's open-detail
   handler doesn't fire. */
.stock-card-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.stock-card-add {
  flex: 1 1 auto;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--gold-deep);
  background: rgba(212, 175, 85, 0.08);
  color: var(--gold-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms ease, border-color 120ms ease, color 120ms ease;
}
.stock-card-add:hover {
  background: rgba(212, 175, 85, 0.16);
  border-color: var(--gold-primary);
  color: var(--text);
}
.stock-card-add svg { flex-shrink: 0; }
.stock-card-edit {
  flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px;
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text-dim);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 120ms ease, color 120ms ease;
}
.stock-card-edit:hover { border-color: var(--gold-primary); color: var(--gold-primary); }
body.stocks-selecting .stock-card-actions { display: none; }

/* Stock-in modal — small focused form: current qty + adet input +
   optional reason + live preview of new total. */
.stock-in-modal .form-modal-panel { max-width: 420px; }
.stock-in-summary {
  border: 1px solid var(--line-soft);
  background: var(--bg-1);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex; flex-direction: column; gap: 4px;
  margin-bottom: 12px;
}
.stock-in-name {
  font-size: 14px; font-weight: 600; color: var(--text);
  word-break: break-word;
}
.stock-in-meta {
  display: flex; gap: 12px; align-items: baseline;
  font-size: 11px; color: var(--text-mute);
}
.stock-in-sku { letter-spacing: 0.04em; }
.stock-in-current { color: var(--text-dim); }
.stock-in-preview {
  margin-top: 4px;
  padding: 8px 10px;
  border-radius: 6px;
  background: rgba(212, 175, 85, 0.10);
  color: var(--gold-primary);
  font-size: 12px; font-weight: 600;
  text-align: center;
}
.form-row-hint {
  color: var(--text-mute);
  font-weight: 400;
  font-size: 10px;
  margin-left: 4px;
}

@media (max-width: 560px) {
  .stocks-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  .stock-card-name { font-size: 12px; }
  .stock-card-sku  { font-size: 10px; }
  .stock-card-qty  { font-size: 12px; padding: 3px 7px; }
  .stock-card-add { font-size: 11px; padding: 5px 8px; }
  .stock-card-edit { width: 28px; height: 28px; }
}
.stock-adjust { display: flex; gap: 6px; }
.stock-adjust-btn {
  border: 1px solid var(--line);
  background: var(--bg-2);
  color: var(--text-dim);
  font-size: 11px;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
  min-width: 36px;
}
.stock-adjust-btn:hover { color: var(--gold); border-color: var(--gold-deep); background: var(--bg-3); }
.stock-adjust-btn:disabled { opacity: 0.4; cursor: wait; }
@media (max-width: 560px) {
  .stock-row {
    grid-template-columns: 40px 1fr auto;
    grid-template-areas: "thumb name qty" "thumb sku qty";
    column-gap: 10px; row-gap: 2px;
  }
  .stock-thumb { grid-area: thumb; align-self: center; width: 40px; height: 40px; }
  .stock-name  { grid-area: name; }
  .stock-sku   { grid-area: sku; font-size: 11px; color: var(--text-mute); }
  .stock-qty   { grid-area: qty; align-self: center; }
  .stock-adjust { justify-content: flex-end; margin-top: 4px; }
}

.export-card { margin-top: 6px; }
.export-body { padding: 8px 16px 14px; display: flex; flex-direction: column; gap: 12px; }
.export-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 10px 0; border-bottom: 1px dashed var(--line-soft); flex-wrap: wrap; }
.export-row:last-child { border-bottom: 0; }
.export-label { flex: 1; min-width: 0; }
.export-title { font-size: 13px; color: var(--text); font-weight: 600; }
.export-sub   { font-size: 11px; color: var(--text-mute); margin-top: 3px; }
.export-inputs { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.export-inputs .filter-date, .export-inputs .filter-select { font-size: 12px; padding: 6px 8px; }

/* Login logo subtle float */
.login-logo { animation: logoFloat 4s ease-in-out infinite; }
@keyframes logoFloat {
  0%, 100% { transform: translateY(0); }
  50%      { transform: translateY(-4px); }
}

/* Inventory transaction ledger + form action layout */
.tx-ledger { margin-top: 14px; border-top: 1px solid var(--line-soft); padding-top: 14px; }
.tx-ledger-head h3 { font-family: var(--brand-font); font-size: 11px; letter-spacing: 0.2em; text-transform: uppercase; color: var(--gold); margin: 0 0 8px; font-weight: 700; }
.tx-row { display: grid; grid-template-columns: 80px 60px 100px 1fr 100px; gap: 10px; padding: 6px 0; font-size: 12px; color: var(--text-dim); border-bottom: 1px dashed var(--line-soft); }
.tx-row:last-child { border-bottom: 0; }
.tx-date  { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--text-mute); }
.tx-delta { font-weight: 700; text-align: center; }
.tx-delta.pos { color: var(--ok); } .tx-delta.neg { color: var(--danger); }
.tx-before-after { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--text-mute); }
.tx-reason { color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tx-actor  { font-size: 11px; color: var(--gold-soft); text-align: right; }
.form-modal-actions { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 16px; }
.form-modal-actions-right { display: flex; gap: 8px; }
.danger { color: var(--danger); border-color: rgba(240,100,80,0.4); }
@media (max-width: 560px) {
  .tx-row { grid-template-columns: 1fr 1fr; gap: 4px; }
  .tx-row > * { grid-column: auto; }
}

/* global-search ---------------------------------------------------------- */
.global-search { position: relative; margin: 0 0 12px; }
.global-search > input[type="search"] {
  width: 100%;
  padding: 8px 10px;
  background: var(--bg-0);
  color: var(--text);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.global-search > input[type="search"]::placeholder { color: var(--text-mute); }
.global-search > input[type="search"]:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.global-search-panel {
  position: absolute;
  left: 0; right: 0; top: calc(100% + 6px);
  z-index: 50;
  max-height: 60vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: rgba(18, 24, 38, 0.96);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  padding: 6px 0;
}
.gs-section + .gs-section { border-top: 1px solid var(--line-soft); margin-top: 4px; padding-top: 4px; }
.gs-section-title {
  font-size: 10px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--text-mute); padding: 6px 12px 4px;
}
.gs-row {
  display: flex; flex-direction: column; align-items: flex-start;
  width: 100%;
  padding: 6px 12px;
  background: transparent; border: 0; cursor: pointer;
  text-align: left;
  color: var(--text-dim);
  border-radius: 0;
  min-width: 0;
}
.gs-row:hover, .gs-row:focus { background: var(--bg-2); color: var(--text); outline: none; }
.gs-row-main {
  font-size: 13px; font-weight: 600; color: var(--text);
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gs-row-sub {
  font-size: 11px; color: var(--text-mute);
  max-width: 100%;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.gs-empty {
  padding: 12px; font-size: 12px; color: var(--text-mute); text-align: center;
}

/* performance --------------------------------------------------------------
   Dark-theme Chart.js cards + KPI strip. */
#admin-performance { display: flex; flex-direction: column; gap: 16px; }
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
@media (max-width: 560px) {
  .kpi-strip { grid-template-columns: 1fr; }
}
.kpi-strip .kpi {
  padding: 14px 16px;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line);
  border-left: 3px solid var(--gold);
  border-radius: var(--r);
  display: flex; flex-direction: column; gap: 6px;
}
.kpi-strip .kpi-label {
  font-size: 11px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-mute);
}
.kpi-strip .kpi-value {
  font-family: var(--brand-font);
  font-size: 22px; letter-spacing: 0.04em;
  color: var(--gold);
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  word-break: break-word;
}
.chart-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}
@media (min-width: 900px) {
  .chart-grid { grid-template-columns: repeat(2, 1fr); }
  .chart-grid > .chart-card:last-child { grid-column: 1 / -1; }
}
.chart-card {
  padding: 14px 16px 18px;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  display: flex; flex-direction: column; gap: 10px;
  min-height: 280px;
}
.chart-card h3 {
  margin: 0;
  font-family: var(--brand-font);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}
.chart-card canvas {
  flex: 1 1 auto;
  min-height: 220px;
  max-height: 320px;
  width: 100% !important;
}

/* ============================================================ */
/* WIZARD — 3-step pager for new-service form                   */
/* ============================================================ */
.wizard-pager {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 6px;
  margin: 4px 0 18px;
  padding: 8px;
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r);
}
.wizard-dot {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--text-mute);
  font-family: var(--sans-font);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.1s;
  min-height: 36px;
  -webkit-tap-highlight-color: transparent;
}
.wizard-dot:hover { color: var(--text-dim); border-color: var(--line); }
.wizard-dot:active { transform: scale(0.98); }
.wizard-dot-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--bg-3);
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.wizard-dot-label {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.wizard-dot.active {
  background: linear-gradient(180deg, var(--gold-soft) 0%, var(--gold) 55%, var(--gold-deep) 100%);
  color: var(--text-on-gold);
  border-color: var(--gold);
  font-weight: 700;
  box-shadow: 0 0 0 3px var(--gold-glow);
}
.wizard-dot.active .wizard-dot-num {
  background: rgba(15, 21, 38, 0.18);
  color: var(--text-on-gold);
}
.wizard-dot.complete {
  border-color: var(--gold);
  color: var(--gold);
}
.wizard-dot.complete .wizard-dot-num {
  background: rgba(225, 176, 71, 0.15);
  color: transparent;
  position: relative;
}
.wizard-dot.complete .wizard-dot-num::after {
  content: "✓";
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--gold);
  font-size: 11px;
  line-height: 1;
}
.wizard-dot-sep {
  flex: 0 0 14px;
  height: 1px;
  background: var(--line);
  opacity: 0.6;
}
.wizard-step { display: none; }
.wizard-step.active { display: block; animation: wizard-fade-in 0.18s ease-out; }
@keyframes wizard-fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to   { opacity: 1; transform: none; }
}
.wizard-nav {
  display: flex;
  gap: 10px;
  align-items: stretch;
  margin-top: 8px;
}
.wizard-nav #btn-wiz-next,
.wizard-nav #btn-save { flex: 1 1 auto; }
.wizard-nav #btn-wiz-back { flex: 0 0 auto; }
@media (max-width: 380px) {
  .wizard-dot-label { display: none; }
  .wizard-dot { padding: 7px 10px; }
}

/* inventory-image */
.inv-image-row {
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 4px;
}
.inv-thumb {
  width: 80px;
  height: 80px;
  border-radius: 6px;
  object-fit: cover;
  background: var(--bg-2);
  border: 1px solid var(--border, rgba(255,255,255,0.08));
}
.inv-upload-ctrls {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.inv-upload-ctrls .inv-file { min-width: 0; flex: 1 1 auto; font-size: 0.85rem; }
.inv-image-placeholder {
  padding: 10px 12px;
  border-radius: 6px;
  background: var(--bg-2);
  color: var(--text-muted, #94a0b0);
  font-size: 0.88rem;
  margin-bottom: 4px;
}

/* media-modal gallery */
.media-modal-root {
  position: fixed; inset: 0;
  z-index: 1000;
  display: grid;
  grid-template-rows: 1fr auto;
  align-items: center; justify-items: center;
}
.media-modal-root .media-modal-stage {
  position: relative;
  width: 100%;
  max-width: min(100%, 1400px);
  max-height: 80vh;
  display: flex; align-items: center; justify-content: center;
  padding: 0 64px;
  box-sizing: border-box;
  overflow: hidden;       /* keep zoomed image inside the stage */
}
.media-modal-root .media-modal-stage > img,
.media-modal-root .media-modal-stage > video {
  max-width: 100%;
  max-height: 80vh;
  object-fit: contain;
  border-radius: 8px;
}
/* Zoomed image owns all touch gestures (pinch + pan + double-tap),
   so the browser's own scroll handling shouldn't interfere. */
.media-modal-root .media-modal-stage > img {
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-user-drag: none;
  cursor: zoom-in;
}
@media (max-width: 560px) {
  .media-modal-root .media-modal-stage { padding: 0 8px; max-height: 78vh; }
}
.media-modal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px; height: 44px;
  min-width: 44px; min-height: 44px;
  border-radius: 50%;
  border: 1px solid rgba(255,255,255,0.25);
  background: rgba(20,22,30,0.6);
  color: #f4f0e7;
  font-size: 28px; line-height: 1;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  z-index: 3;
}
.media-modal-arrow-prev { left: 16px; }
.media-modal-arrow-next { right: 16px; }
.media-modal-arrow:disabled { opacity: 0.3; cursor: default; }
.media-modal-strip {
  grid-row: 2;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  display: flex;
  gap: 6px;
  padding: 8px;
  box-sizing: border-box;
  justify-content: flex-start;
  -webkit-overflow-scrolling: touch;
  background: rgba(0,0,0,0.35);
  z-index: 2;
}
.media-modal-thumb {
  flex: 0 0 auto;
  width: 48px; height: 48px;
  padding: 0;
  border-radius: 6px;
  border: 2px solid transparent;
  background: #111;
  cursor: pointer;
  overflow: hidden;
}
.media-modal-thumb > img,
.media-modal-thumb > video {
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.media-modal-thumb.active { border-color: var(--gold); }

/* ---------------------------------------------------------------------------
   Customer picker (Step 1 of new-service wizard)
   --------------------------------------------------------------------------- */
.customer-picker-field { position: relative; display: flex; flex-direction: column; gap: 6px; }
.customer-picker-field > span { font-size: 12px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted, #8a8a8a); }
#customer-input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--hairline, #2a2f3d);
  background: var(--bg-2, #121826);
  color: var(--text, #e8e3d0);
  font-size: 15px;
}
.customer-selected {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--gold-deep, #8c6319);
  background: rgba(184, 135, 30, 0.08);
  color: var(--text, #e8e3d0);
  font-weight: 600;
}
#customer-clear {
  background: transparent; border: 0; color: var(--muted, #8a8a8a);
  font-size: 22px; line-height: 1; padding: 2px 8px; cursor: pointer;
}
#customer-clear:hover { color: var(--gold, #b8871e); }
.customer-results {
  max-height: 280px; overflow-y: auto;
  border: 1px solid var(--hairline, #2a2f3d);
  border-radius: 8px;
  background: var(--bg-2, #121826);
  display: flex; flex-direction: column;
}
.customer-result {
  display: block; width: 100%; text-align: left;
  padding: 10px 12px;
  border: 0; border-bottom: 1px solid var(--hairline, #2a2f3d);
  background: transparent; color: var(--text, #e8e3d0);
  cursor: pointer;
}
.customer-result:last-child { border-bottom: 0; }
.customer-result:hover, .customer-result:focus-visible {
  background: rgba(184, 135, 30, 0.1);
  outline: 0;
}
.customer-result-name { font-weight: 600; font-size: 14px; }
.customer-result-meta { font-size: 12px; color: var(--muted, #8a8a8a); margin-top: 2px; }
.customer-result-empty { padding: 12px; color: var(--muted, #8a8a8a); font-size: 13px; text-align: center; }

/* v1.1.0 small additions */
.login-version { font-size: 11px; color: var(--muted, #8a8a8a); letter-spacing: 0.08em; margin-top: 6px; }
.collapsible { border: 1px solid var(--hairline, #2a2f3d); border-radius: 8px; padding: 0; }
.collapsible > summary {
  cursor: pointer; list-style: none; padding: 12px 14px;
  display: flex; align-items: center; justify-content: space-between;
  font-size: 14px; font-weight: 600; color: var(--text, #e8e3d0);
}
.collapsible > summary::-webkit-details-marker { display: none; }
.collapsible[open] > summary { border-bottom: 1px solid var(--hairline, #2a2f3d); }
.collapsible > :not(summary) { padding: 12px 14px; }
.collapsible-count { color: var(--gold, #b8871e); font-weight: 700; font-size: 13px; }

.page-lead { color: var(--muted, #8a8a8a); font-size: 13px; margin: 6px 0 14px; }

/* Notifications settings */
.notif-card {
  background: var(--bg-2, #121826);
  border: 1px solid var(--hairline, #2a2f3d);
  border-radius: 10px;
  padding: 18px 20px;
  max-width: 640px;
  margin-top: 18px;
}
.notif-status { font-size: 14px; line-height: 1.5; margin: 0 0 12px; color: var(--text, #e8e3d0); }
.notif-hint   { font-size: 13px; line-height: 1.45; margin: 0 0 12px; padding: 10px 12px;
                background: rgba(184, 135, 30, 0.08); border-left: 3px solid var(--gold, #b8871e);
                border-radius: 4px; color: var(--text, #e8e3d0); }
.notif-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 6px 0 14px; }
.notif-info   { color: var(--muted, #8a8a8a); font-size: 12.5px; line-height: 1.6;
                margin: 14px 0 0; padding-left: 18px; }
.notif-info li { margin: 4px 0; }

/* Media section empty state + media count badge */
.empty-hint { color: var(--muted, #8a8a8a); font-size: 13px; font-style: italic; margin: 6px 0; }
.media-count { color: var(--muted, #8a8a8a); font-weight: 400; font-size: 13px; margin-left: 6px; }
.media-count.warn { color: var(--warn, #c49a3a); }
.record-media-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 8px; border-radius: 10px;
  background: rgba(184, 135, 30, 0.15);
  color: var(--gold, #b8871e);
  font-size: 12px; font-weight: 600;
}

/* ---- v1.2 polish pass (engineer-flow 2026-04-24) ---------------------- */

/* Force-hide wizard buttons marked hidden. Default display:flex on the
   parent was overriding [hidden] and showing both İleri + Kaydet. */
.wizard-nav button[hidden],
.detail-head-actions button[hidden] { display: none !important; }

/* The customer-picker "selected chip" and the results dropdown use
   display:flex, which overrides the native [hidden] attribute — so the
   empty chip box was showing next to the search field and looked like a
   duplicated input. Force hidden to actually hide. */
#customer-selected[hidden],
#customer-results[hidden] { display: none !important; }

/* Login API-base row uses display:grid, so [hidden] was being ignored
   and the debug-only field was leaking to engineers. Force-hide. */
.api-hint[hidden] { display: none !important; }

/* (WhatsApp parser styles removed — feature pulled from engineer flow.) */
.media-add-btn.is-busy,
label.is-busy { opacity: 0.7; pointer-events: none; }

/* Role pill in sidebar — capital-cased, gold. Replaces raw lowercase "engineer". */
.sidebar-user .role-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  background: rgba(184, 135, 30, 0.15);
  color: var(--gold, #b8871e);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 3px;
}

/* Video tile overlay — was rendering as a black square. Play icon + VIDEO pill. */
.media-tile { position: relative; }
.media-tile.is-video::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    linear-gradient(rgba(0,0,0,0.25), rgba(0,0,0,0.55)),
    radial-gradient(circle at 50% 50%, rgba(255,255,255,0.08) 0%, transparent 40%);
  pointer-events: none;
}
.media-tile.is-video::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 40px; height: 40px;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  border: 2px solid rgba(255,255,255,0.9);
  clip-path: polygon(35% 25%, 75% 50%, 35% 75%);
  pointer-events: none;
}
.media-tile .media-type-pill {
  position: absolute;
  top: 8px; left: 8px;
  padding: 2px 7px;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  pointer-events: none;
  z-index: 2;
}

/* Detail head actions row — space admin expertise/edit buttons */
.detail-head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Record detail — engineer-visible edit/add-media buttons */
.record-actions-row {
  display: flex; gap: 10px; flex-wrap: wrap;
  margin: 14px 0 4px;
}

/* Home: recent-service card */
.home-recent-card { margin-top: 16px; }
.home-recent-card .dash-list {
  display: flex; flex-direction: column; gap: 8px;
}
.home-recent-card .record-card { cursor: pointer; }

/* Service-form: resolution textarea spacing */
.view-service-form textarea[name="resolution"] {
  min-height: 92px;
}

/* ---- Admin greeting (replaces the bulky page-head with kicker+title) ---- */
/* Ambient depth for the admin dashboard: a faint gold glow top-right plus a
   cool navy wash top-left, layered behind the page. Scoped to the admin home
   so engineer / login views stay flat. */
.view-admin-home {
  position: relative;
}
.view-admin-home::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 0;
  background:
    radial-gradient(1100px 520px at 78% -6%, rgba(225,176,71,0.09), transparent 60%),
    radial-gradient(900px 600px at 10% 0%, rgba(40,60,110,0.16), transparent 55%);
}
.view-admin-home > * { position: relative; z-index: 1; }

.admin-greeting {
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px;
  margin: 0 0 20px; flex-wrap: wrap;
}
.admin-greeting-text {
  display: flex; flex-direction: column; gap: 5px; min-width: 0;
}
.admin-greeting-hello {
  font-size: 11px; letter-spacing: 0.26em; text-transform: uppercase;
  color: var(--gold-deep); font-weight: 700;
}
.admin-greeting-name {
  font-size: 29px; font-weight: 600; color: var(--text);
  letter-spacing: 0.01em; line-height: 1.1;
}
.admin-greeting-name b { color: var(--gold); font-weight: 700; }
.admin-greeting-right { display: flex; align-items: center; gap: 12px; }
.admin-date-chip {
  font-size: 12px; color: var(--text-mute);
  padding: 8px 13px; border-radius: 999px;
  border: 1px solid var(--line); background: var(--bg-1);
  white-space: nowrap;
}
@media (max-width: 560px) {
  .admin-greeting-name { font-size: 23px; }
  .admin-date-chip { display: none; }
}

/* ---- Admin home: compact 3-up tile row (Müşteriler · Makineler · Etkinlik)
   Visual chips that take far less space than the previous full home-tile
   cards while still working as the main mobile entry points. */
.admin-tiles {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 12px 0;
}
.admin-tile {
  display: flex; align-items: center; gap: 11px;
  padding: 14px 16px;
  border-radius: var(--r);
  border: 1px solid var(--line);
  background: var(--bg-1);
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}
.admin-tile:hover { border-color: var(--gold-deep); background: var(--bg-2); transform: translateY(-2px); }
.admin-tile svg { width: 18px; height: 18px; color: var(--gold); flex-shrink: 0; }
.admin-tile::after {
  content: "→"; margin-left: auto; color: var(--text-mute);
  transition: color 160ms ease, transform 160ms ease;
}
.admin-tile:hover::after { color: var(--gold); transform: translateX(2px); }
@media (max-width: 560px) {
  .admin-tile { font-size: 12px; padding: 11px 12px; gap: 8px; }
  .admin-tile svg { width: 16px; height: 16px; }
}

/* ---- Machine lookup (engineer) ---- */
.view-machine-lookup .filter-bar-simple { margin-bottom: 12px; }
.view-machine-lookup #machine-lookup-input {
  background: var(--bg-1); color: var(--text);
  border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 10px 12px; font-size: 15px;
}
.machine-lookup-results { display: flex; flex-direction: column; gap: 6px; }
.lookup-result {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  font-family: inherit;
}
.lookup-result:hover { border-color: var(--gold-deep); background: var(--bg-2); }
.lookup-result-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.lookup-result-model { font-weight: 600; font-size: 14px; color: var(--text); }
.lookup-result-serial { font-size: 12px; color: var(--text-dim); }
.lookup-result-cust { color: var(--gold); font-size: 13px; flex-shrink: 0; }
.machine-lookup-detail { margin-top: 16px; display: flex; flex-direction: column; gap: 10px; }
.machine-preview-cust { font-size: 13px; color: var(--gold-soft); margin-top: 2px; }

/* ---- Admin activity log ---- */
.admin-activity-list { display: flex; flex-direction: column; gap: 6px; }
.activity-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 14px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r);
}
.activity-row-main { min-width: 0; flex: 1; }
.activity-actor { font-weight: 600; font-size: 14px; color: var(--text); }
.activity-text {
  display: flex; flex-wrap: wrap; gap: 8px;
  font-size: 12px; color: var(--text-dim); margin-top: 3px;
}
.activity-customer { color: var(--gold); }
.activity-model    { color: var(--text-dim); }
.activity-serial   { color: var(--text-dim); }
.activity-when {
  color: var(--text-mute); font-size: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  flex-shrink: 0;
  white-space: nowrap;
}
@media (max-width: 560px) {
  .activity-row { flex-direction: column; align-items: flex-start; gap: 4px; }
  .activity-when { align-self: flex-end; }
}

/* ---- Machine-history timeline (Makine geçmişi → service entries) ----
   Always-expanded entries so an engineer can scroll and read in one pass
   instead of clicking each visit open. Optimised for skim-reading on
   mobile: bold date header, gold personnel, then ARIZA / ÇÖZÜM / PARÇALAR
   sections with consistent left-aligned typography. */
.history-list { display: flex; flex-direction: column; gap: 12px; }
.history-entry {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 10px;
}
.history-entry-head {
  display: flex; align-items: baseline; justify-content: space-between; gap: 14px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--line-soft);
}
.history-entry-date {
  display: flex; align-items: baseline; gap: 8px;
  flex-shrink: 0;
}
.history-entry-day {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  letter-spacing: 0.02em;
}
.history-entry-time {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text-mute);
}
.history-entry-engineer {
  font-size: 13px;
  color: var(--gold);
  font-weight: 600;
  text-align: right;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  min-width: 0;
}
.history-entry-body {
  display: flex; flex-direction: column; gap: 12px;
}
.history-entry-section {
  display: flex; flex-direction: column; gap: 4px;
}
.history-entry-label {
  font-family: var(--brand-font);
  font-size: 10px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}
.history-entry-text {
  font-size: 15px;
  color: var(--text);
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}
.history-entry-parts {
  list-style: none; padding: 0; margin: 0;
  display: flex; flex-direction: column; gap: 4px;
}
.history-entry-parts li {
  font-size: 14px;
  color: var(--text);
  padding: 6px 10px;
  background: var(--bg-2);
  border-radius: var(--r-sm);
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.history-entry-part-name { font-weight: 600; }
.history-entry-part-sku  { color: var(--text-dim); font-size: 12px; }
.history-entry-part-qty  {
  margin-left: auto;
  color: var(--gold);
  font-weight: 700;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.history-entry-media {
  font-size: 13px;
  color: var(--text-mute);
  font-style: italic;
}
.history-entry-empty {
  font-size: 13px;
  color: var(--text-mute);
  font-style: italic;
}
@media (max-width: 560px) {
  .history-entry { padding: 12px 14px; }
  .history-entry-head { flex-direction: column; align-items: flex-start; gap: 4px; padding-bottom: 6px; }
  .history-entry-engineer { text-align: left; }
  .history-entry-text { font-size: 14px; }
}

/* ---- Pull-to-refresh indicator ---- */
.ptr-indicator {
  position: fixed; top: 0; left: 50%;
  transform: translate(-50%, -100%);
  display: flex; align-items: center; gap: 10px;
  padding: 8px 16px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: var(--shadow-sm);
  z-index: 5000;
  pointer-events: none;
  opacity: 0;
  transition: opacity 140ms ease, transform 180ms ease;
  font-size: 13px;
  color: var(--text-dim);
  font-weight: 600;
  margin-left: -56px;          /* visually centre against the icon */
}
.ptr-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--text-mute);
  border-top-color: var(--gold);
  transition: transform 180ms ease, border-color 180ms ease;
}
.ptr-armed .ptr-dot { transform: rotate(180deg); border-color: var(--gold); }
.ptr-busy  .ptr-dot { animation: ptr-spin 720ms linear infinite; border-color: transparent; border-top-color: var(--gold); }
.ptr-armed .ptr-label,
.ptr-busy  .ptr-label { color: var(--gold); }
@keyframes ptr-spin {
  to { transform: rotate(360deg); }
}

/* ---- Stock-card buttonification ---- */
.stock-card {
  /* card now a <button> for keyboard a11y + native click feedback */
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
  width: 100%;
  padding: 0;
}
.stock-card:focus-visible {
  outline: none;
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(225, 176, 71, 0.25);
}

/* ---- Admin stock detail page ---- */
.view-admin-stock-detail { display: flex; flex-direction: column; gap: 16px; }

.stock-detail-card {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 18px;
  padding: 16px;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--line);
  border-radius: var(--r);
  align-items: stretch;
}
.stock-detail-thumb {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  padding-bottom: 100%;
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.stock-detail-thumb img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
@supports (aspect-ratio: 1 / 1) {
  .stock-detail-thumb { padding-bottom: 0; }
}
.stock-detail-meta {
  display: flex; flex-direction: column; gap: 8px;
  min-width: 0;
}
.stock-detail-name {
  font-size: 20px; font-weight: 700; color: var(--text);
  line-height: 1.2; word-break: break-word;
}
.stock-detail-sku {
  font-size: 13px;
  color: var(--text-mute);
  letter-spacing: 0.04em;
}
.stock-detail-stats {
  margin-top: auto;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.stock-detail-stat {
  background: var(--bg-1);
  border: 1px solid var(--line-soft);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.stock-detail-stat-label {
  font-family: var(--brand-font);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-mute);
  font-weight: 700;
}
.stock-detail-stat-value {
  font-family: var(--brand-font);
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.02em;
  line-height: 1;
}
.stock-detail-stat-value.stock-detail-qty-low  { color: var(--warn); }
.stock-detail-stat-value.stock-detail-qty-zero { color: var(--danger); }

.stock-detail-section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 8px;
}
.stock-detail-section-head h2 {
  margin: 0;
  font-family: var(--brand-font);
  font-size: 12px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}
.stock-detail-section-actions {
  display: flex; align-items: center; gap: 12px;
}
.stock-detail-count {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  color: var(--text-mute);
}
.stock-detail-pdf {
  display: inline-flex; align-items: center; gap: 6px;
}
.stock-detail-pdf svg { display: block; flex-shrink: 0; }
.stock-detail-pdf:disabled { opacity: 0.6; cursor: progress; }
@media (max-width: 560px) {
  .stock-detail-section-head { flex-wrap: wrap; }
  .stock-detail-section-actions { width: 100%; justify-content: space-between; }
  .stock-detail-pdf { flex: 1; justify-content: center; }
}

.stock-detail-list {
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  background: var(--bg-1);
}
.stock-detail-row {
  display: grid;
  grid-template-columns: 96px 130px 60px 1fr 48px 130px;
  gap: 10px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--line-soft);
  align-items: baseline;
  cursor: pointer;
  transition: background 120ms ease;
}
.stock-detail-row:hover  { background: var(--bg-2); }
.stock-detail-row:last-child { border-bottom: 0; }
.stock-detail-row-date     { font-weight: 600; font-size: 13px; color: var(--text); }
.stock-detail-row-serial   { font-size: 12px; color: var(--text-dim); }
.stock-detail-row-model    { font-family: var(--brand-font); font-size: 11px; letter-spacing: 0.06em; color: var(--text-mute); }
.stock-detail-row-customer { font-size: 13px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stock-detail-row-qty      { font-family: var(--brand-font); font-size: 14px; font-weight: 700; color: var(--gold); text-align: right; }
.stock-detail-row-engineer { font-size: 12px; color: var(--gold-soft);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

@media (max-width: 720px) {
  .stock-detail-card { grid-template-columns: 1fr; }
  .stock-detail-thumb { width: 60%; max-width: 220px; margin: 0 auto; }
  .stock-detail-row {
    grid-template-columns: 1fr auto;
    grid-template-areas:
      "date     qty"
      "serial   qty"
      "customer customer"
      "engineer model";
    column-gap: 10px; row-gap: 2px;
  }
  .stock-detail-row-date     { grid-area: date; }
  .stock-detail-row-serial   { grid-area: serial; }
  .stock-detail-row-customer { grid-area: customer; }
  .stock-detail-row-model    { grid-area: model; text-align: right; }
  .stock-detail-row-qty      { grid-area: qty; align-self: center; font-size: 18px; }
  .stock-detail-row-engineer { grid-area: engineer; }
}

/* ---- Stock selection mode (multi-part PDF report) ---- */
.stock-select-toggle.stock-select-toggle-active {
  background: var(--bg-3);
  color: var(--gold);
  border-color: var(--gold-deep);
}
/* Tick — hidden by default; visible only when selection mode is on. */
.stock-card-tick {
  position: absolute;
  top: 8px; left: 8px;
  width: 24px; height: 24px;
  border-radius: 999px;
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  background: rgba(9, 14, 26, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  color: transparent;
  display: none;
  align-items: center; justify-content: center;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
  pointer-events: none;
}
body.stocks-selecting .stock-card-tick { display: flex; }
body.stocks-selecting .stock-card-uses,
body.stocks-selecting .stock-card-qty  { opacity: 0.6; }
body.stocks-selecting .stock-card:hover {
  transform: none;          /* keep stable while picking */
}
.stock-card-selected .stock-card-tick {
  background: var(--gold);
  border-color: var(--gold);
  color: var(--text-on-gold, #0f1526);
}
.stock-card-selected {
  border-color: var(--gold) !important;
  box-shadow: 0 0 0 3px rgba(225, 176, 71, 0.25);
}

/* Floating action bar — fixed at the bottom of the viewport. */
.stock-select-bar {
  position: fixed;
  left: 50%;
  bottom: calc(16px + var(--safe-bot, 0px));
  transform: translateX(-50%);
  display: flex; align-items: center; gap: 14px;
  padding: 10px 16px;
  background: linear-gradient(180deg, var(--bg-2) 0%, var(--bg-1) 100%);
  border: 1px solid var(--gold-deep);
  border-radius: 999px;
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.5);
  z-index: 4000;
  max-width: calc(100vw - 24px);
}
.stock-select-bar[hidden] { display: none !important; }
.stock-select-bar-info {
  display: flex; align-items: center; gap: 10px;
}
.stock-select-bar-count {
  font-family: var(--brand-font);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold);
  font-weight: 700;
}
.stock-select-bar-actions {
  display: flex; align-items: center; gap: 8px;
}
@media (max-width: 560px) {
  .stock-select-bar {
    left: 12px; right: 12px;
    transform: none;
    border-radius: 14px;
    flex-direction: column; align-items: stretch; gap: 8px;
    padding: 10px 12px;
  }
  .stock-select-bar-info { justify-content: space-between; }
  .stock-select-bar-actions { width: 100%; }
  .stock-select-bar-actions .btn { flex: 1; }
}

/* ---- Stock detail: "Fotoğraf yükle" overlay (admin one-way upload) ---- */
.stock-detail-thumb.stock-detail-thumb-missing img {
  opacity: 0.25;
  filter: grayscale(0.6);
}
.stock-detail-upload {
  position: absolute;
  inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 6px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(9,14,26,0.35) 0%, rgba(9,14,26,0.55) 100%);
  color: var(--gold);
  cursor: pointer;
  text-align: center;
  transition: background 160ms ease, color 160ms ease;
}
.stock-detail-upload:hover {
  background: linear-gradient(180deg, rgba(9,14,26,0.5) 0%, rgba(225,176,71,0.18) 100%);
}
.stock-detail-upload svg {
  width: 22px; height: 22px;
  padding: 8px;
  border: 1.5px solid currentColor;
  border-radius: 999px;
}
.stock-detail-upload-label {
  font-family: var(--brand-font);
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 700;
}
.stock-detail-upload-hint {
  font-size: 10px;
  color: var(--text-mute);
  letter-spacing: 0.02em;
}
.stock-detail-upload-busy {
  cursor: progress;
  background: rgba(9,14,26,0.7);
}
.stock-detail-upload-busy svg { animation: ptr-spin 720ms linear infinite; }
