:root {
  --bg: #eef1f6;
  --surface: #ffffff;
  --border: #dbe1ea;
  --ink: #1c2430;
  --ink-soft: #5b6472;
  --ink-faint: #8b93a1;

  --brand: #D71920;
  --brand-dark: #a3141a;
  --brand-tint: #fbeaea;

  --win: #1e8e5a;
  --win-tint: #e7f5ee;
  --competitor: #c2410c;
  --competitor-tint: #fdece2;
  --poc: #b7791f;
  --poc-tint: #fbf1de;
  --none: #94a3b8;
  --none-tint: #eef1f5;

  --info: #4f6bed;
  --info-tint: #ecefff;
  --violet: #7c5cbf;
  --violet-tint: #f1ecfa;
  --teal: #0f8a7e;
  --teal-tint: #e6f5f3;

  --radius: 10px;
  --font-body: -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ---- Layout (Heatmap-style) ---- */
.app-shell { display: flex; min-height: 100vh; align-items: stretch; }

.sidebar {
  width: 232px;
  flex-shrink: 0;
  background: #0f1218;
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 4px 16px;
  margin-bottom: 16px;
  border-bottom: 1px solid rgba(255,255,255,0.10);
}
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
  display: flex; align-items: center; gap: 10px;
  color: rgba(255,255,255,0.72);
  padding: 8px 10px 8px 12px;
  border-radius: 8px;
  font-size: 13.5px; font-weight: 500; text-decoration: none;
  transition: background 0.12s ease, color 0.12s ease;
}
.sidebar-nav a:hover { background: rgba(255,255,255,0.08); color: #fff; text-decoration: none; }
.sidebar-nav a.active {
  background: rgba(215,25,32,0.22);
  color: #fff;
  box-shadow: inset 3px 0 0 var(--brand);
}
.nav-ic { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.7; transition: opacity 0.12s ease; }
.sidebar-nav a:hover .nav-ic, .sidebar-nav a.active .nav-ic { opacity: 1; }
.nav-label {
  font-size: 10px; letter-spacing: 0.1em; text-transform: uppercase;
  color: rgba(255,255,255,0.38); font-weight: 600; padding: 16px 12px 5px;
}
.nav-label:first-child { padding-top: 2px; }
.sidebar-version {
  margin-top: auto; padding: 14px 12px 2px;
  font-size: 10px; letter-spacing: 0.08em;
  color: rgba(255,255,255,0.28); text-transform: uppercase; font-weight: 600;
}

.main-area { flex: 1; min-width: 0; background: var(--bg); display: flex; flex-direction: column; }

.topbar {
  position: relative; display: flex; align-items: center;
  min-height: 52px; padding: 8px 24px;
  background: var(--brand); border-bottom: 1px solid var(--brand-dark); flex-shrink: 0;
}
.topbar-center {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  white-space: nowrap; pointer-events: none;
  font-weight: 700; letter-spacing: -0.02em; font-size: 16px; color: #fff;
}
.topbar-left { display: flex; flex-direction: column; align-items: flex-start; justify-content: center; z-index: 1; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 14px; z-index: 1; }
.topbar-user-name { font-size: 12px; color: rgba(255,255,255,0.85); text-align: left; line-height: 1.5; }
.topbar-last-login { display: block; font-size: 10.5px; color: rgba(255,255,255,0.72); margin-top: 2px; letter-spacing: 0.02em; }
.topbar-logout { color: rgba(255,255,255,0.7); font-size: 12px; }
.topbar-logout:hover { color: #fff; }

.beta-badge {
  display: inline-block; background: var(--poc); color: #fff;
  font-size: 10px; font-weight: 800; letter-spacing: 0.1em;
  padding: 2px 9px; border-radius: 999px; vertical-align: middle;
}
.beta-badge.on-dark { background: #fff; color: var(--brand); }

.container { width: 100%; margin: 0 auto; padding: 28px 26px 60px; }

h1 { font-size: 20px; letter-spacing: -0.01em; margin: 0 0 4px; font-weight: 700; }
h2 { font-size: 15px; letter-spacing: -0.01em; margin: 0 0 14px; color: var(--ink); font-weight: 700; }
h3 { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--brand-dark); margin: 0 0 12px; }
.page-sub { color: var(--ink-soft); font-size: 13px; margin: 0 0 22px; }

/* ---- Cards ---- */
.card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(28,36,48,0.05);
}
.section-gap { margin-top: 18px; }

/* ---- KPI row (Heatmap-matched) ---- */
.kpi-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 14px; margin-bottom: 24px; }
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--none);
  border-radius: var(--radius);
  padding: 15px 18px 16px;
  text-align: center;
}
.kpi .n { font-family: var(--font-mono); font-size: 24px; font-weight: 600; letter-spacing: -0.02em; line-height: 1; }
.kpi .l { font-size: 11px; color: var(--ink-soft); margin-top: 8px; text-transform: uppercase; letter-spacing: 0.06em; }
.kpi.total { border-top-color: var(--info); }
.kpi.total .n { color: var(--info); }
.kpi.available { border-top-color: var(--win); }
.kpi.available .n { color: var(--win); }
.kpi.onloan { border-top-color: var(--poc); }
.kpi.onloan .n { color: var(--poc); }
.kpi.overdue { border-top-color: var(--brand); }
.kpi.overdue .n { color: var(--brand); }

/* ---- Tables (Heatmap-matched) ---- */
table a { text-decoration: none; }
table a:hover .chip { filter: brightness(0.93); text-decoration: none; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th { background: #eef2f8; border-bottom: 2px solid #d4dbe6; }
th {
  text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--ink-soft); padding: 8px 10px; font-weight: 600;
}
td { padding: 10px 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f5f7fa; }

/* ---- Chips ---- */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
}
.chip.available { background: var(--win-tint); color: var(--win); }
.chip.onloan { background: var(--poc-tint); color: var(--poc); }
.chip.maintenance { background: var(--info-tint); color: var(--info); }
.chip.faulty { background: var(--competitor-tint); color: var(--competitor); }
.chip.retired { background: var(--none-tint); color: var(--ink-soft); }
.chip.overdue { background: var(--brand-tint); color: var(--brand); }
.chip.ongoing { background: var(--info-tint); color: var(--info); }
.chip.win { background: var(--win-tint); color: var(--win); }
.chip.loss { background: var(--competitor-tint); color: var(--competitor); }

/* ---- Forms ---- */
label.field { display: block; margin-bottom: 12px; }
label.field .lbl { display: block; font-size: 11px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=date], select, textarea {
  width: 100%; padding: 8px 11px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 13.5px; font-family: inherit; background: #fff; color: var(--ink);
}
textarea { min-height: 70px; resize: vertical; }
select.inline, input.inline { width: auto; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--brand); color: #fff; border: none; border-radius: 8px;
  padding: 9px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer; font-family: inherit;
}
.btn:hover { background: var(--brand-dark); text-decoration: none; }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--border); }
.btn.secondary:hover { background: #f4f6fa; }
.btn.ghost { background: transparent; color: var(--brand); border: 1px solid var(--brand); }

.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-bottom: 16px; }

/* ---- Flash ---- */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; }
.flash.ok { background: var(--win-tint); color: var(--win); }
.flash.error { background: var(--brand-tint); color: var(--brand); }

/* ---- Login ---- */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #131922; }
.login-card { background: #fff; border-radius: 14px; padding: 34px 32px; width: 340px; box-shadow: 0 12px 40px rgba(0,0,0,0.3); }
.login-card .brand { font-size: 19px; font-weight: 700; margin-bottom: 4px; }
.login-card .brand span { color: var(--brand); }
.login-card .sub { color: var(--ink-soft); font-size: 13px; margin-bottom: 20px; }

.empty-note { color: var(--ink-faint); font-size: 13px; font-style: italic; }
.mono { font-family: var(--font-mono); font-size: 12.5px; }

/* ---- Detail hero ---- */
.hero { display: flex; gap: 16px; align-items: center; }
.hero .mono-badge {
  width: 54px; height: 54px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700; background: var(--brand-tint); color: var(--brand);
}

/* ==== Dark Cockpit (heatmap ile ortak tasarim dili) ==== */
.sidebar.cockpit { background: #1c2430; padding-top: 0; }
.sidebar.cockpit .sidebar-brand {
  min-height: 52px; align-items: center;
  margin: 0 -16px 16px; padding: 0 20px;
  border-bottom: 3px solid var(--brand);
}
.sidebar.cockpit .sidebar-nav a { color: rgba(255,255,255,0.82); }
.sidebar.cockpit .sidebar-nav a:hover { background: rgba(255,255,255,0.07); }
.sidebar.cockpit .sidebar-nav a.active {
  background: #fff; color: #1c2430;
  box-shadow: 0 2px 10px rgba(6,10,18,0.35);
  font-weight: 700;
}
.sidebar.cockpit .nav-ic { opacity: 1; }
.sidebar.cockpit .nic-panel     { color: #F0575D; }
.sidebar.cockpit .nic-inventory { color: #5B8DEF; }
.sidebar.cockpit .nic-loans     { color: #EF9F27; }
.sidebar.cockpit .nic-timeline  { color: #2DD4BF; }
.sidebar.cockpit .nic-ship      { color: #8A63D2; }
.sidebar.cockpit .nic-users     { color: #9AA7B8; }

.topbar.cockpit { background: #1c2430; border-bottom: 3px solid var(--brand); }
.topbar.cockpit .beta-badge.on-dark { background: var(--brand); color: #fff; }
.topbar.cockpit::before {
  content: ""; position: absolute; left: 0; top: 50%; transform: translateY(-50%);
  width: 1px; height: 20px; background: rgba(255,255,255,0.2);
}
.sidebar.cockpit ~ .main-area .container { border-left: 3px solid var(--brand); }
.topbar.cockpit .topbar-right { display: flex; align-items: center; }
.topbar.cockpit .topbar-divider {
  width: 1px; height: 20px; background: rgba(255,255,255,0.2); margin: 0 8px 0 12px;
}
.topbar.cockpit .topbar-iconbtn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 8px;
  color: rgba(255,255,255,0.78); margin-left: 6px;
}
.topbar.cockpit .topbar-iconbtn svg { width: 17px; height: 17px; }
.topbar.cockpit .topbar-iconbtn:hover { background: rgba(255,255,255,0.10); color: #fff; text-decoration: none; }
.kpi.reserved { border-top-color: var(--violet); }
.kpi.reserved .n { color: var(--violet); }
.topbar-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(255,255,255,0.07);
  border: 1px solid rgba(255,255,255,0.13);
  border-radius: 999px;
  padding: 6px 8px 6px 12px;
  color: rgba(255,255,255,0.55);
  font-size: 12.5px;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.topbar-search:hover { background: rgba(255,255,255,0.12); color: rgba(255,255,255,0.85); }
.topbar-search kbd {
  font-family: inherit;
  font-size: 10px;
  font-weight: 700;
  color: rgba(255,255,255,0.5);
  border: 1px solid rgba(255,255,255,0.22);
  border-radius: 5px;
  padding: 1px 6px;
}
