/* barox Virtual Switch Simulator — application styles.
   Built on top of barox-design-system.css tokens (navy/amber). Enterprise
   NMS look: dense, no marketing hero/card-grid patterns, desktop-first. */

body {
  background: var(--bg);
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* ---------------------------- Sidebar --------------------------------- */
.app-sidebar {
  width: 220px;
  flex: 0 0 220px;
  background: var(--navy);
  color: var(--navy-20);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.app-sidebar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.app-sidebar .brand img { height: 26px; width: auto; }
.app-sidebar .brand-text { font-family: var(--font-display); font-weight: 800; color: var(--white); font-size: 0.98rem; line-height: 1.2; }
.app-sidebar .brand-text small { display: block; font-family: var(--font-text); font-weight: 500; color: var(--amber); font-size: 0.72rem; }

.app-nav { padding: 10px 8px; flex: 1; overflow-y: auto; }
.app-nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; margin-bottom: 2px; border-radius: var(--radius);
  color: var(--navy-20); text-decoration: none; font-size: 0.92rem; font-weight: 500;
}
.app-nav a:hover { background: rgba(255,255,255,0.08); color: var(--white); }
.app-nav a.active { background: var(--amber); color: var(--navy); font-weight: 700; }
.app-nav .nav-section-title {
  padding: 14px 12px 6px; font-size: 0.72rem; text-transform: uppercase;
  letter-spacing: 0.06em; color: var(--navy-40); font-weight: 700;
}
.app-sidebar .user-box {
  padding: 12px 16px; border-top: 1px solid rgba(255,255,255,0.12); font-size: 0.85rem;
}
.app-sidebar .user-box .role { color: var(--amber); font-weight: 700; text-transform: capitalize; }
.app-sidebar .user-box a { color: var(--navy-20); }
.app-sidebar .user-box a:hover { color: var(--amber); }

/* ----------------------------- Main ------------------------------------ */
.app-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.app-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 26px; background: var(--white); border-bottom: 1px solid var(--line);
}
.app-topbar h1 { margin: 0; font-size: 1.3rem; }
.app-topbar .crumbs { font-size: 0.82rem; color: var(--grey); }
.app-content { padding: 22px 26px 40px; flex: 1; }

/* ----------------------------- Sub-nav (switch detail tabs) ------------ */
.subnav { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 20px; border-bottom: 1px solid var(--line); }
.subnav a {
  padding: 9px 14px; font-size: 0.88rem; font-weight: 500; color: var(--grey);
  text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.subnav a:hover { color: var(--navy); }
.subnav a.active { color: var(--navy); font-weight: 700; border-bottom-color: var(--amber); }

/* ----------------------------- Stat tiles ------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-tile { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; box-shadow: var(--shadow); }
.stat-tile .label { font-size: 0.76rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--grey); font-weight: 700; }
.stat-tile .value { font-family: var(--font-display); font-size: 1.7rem; color: var(--navy); font-weight: 800; margin-top: 4px; }
.stat-tile .value.amber { color: var(--amber-dark); }
.stat-tile .value.error { color: var(--error); }
.stat-tile .sub { font-size: 0.78rem; color: var(--grey); margin-top: 2px; }

/* ----------------------------- Panels ----------------------------------- */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-lg); box-shadow: var(--shadow); margin-bottom: 22px; }
.panel-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line); }
.panel-header h2 { margin: 0; }
.panel-body { padding: 18px; }
.panel-body.no-pad { padding: 0; }

/* ----------------------------- Tables ------------------------------------ */
.table-dense { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
.table-dense th, .table-dense td { padding: 8px 12px; border-bottom: 1px solid var(--line); text-align: left; white-space: nowrap; }
.table-dense thead th {
  background: var(--navy-10); color: var(--navy); font-weight: 700; font-size: 0.76rem;
  text-transform: uppercase; letter-spacing: 0.03em; position: sticky; top: 0;
}
.table-dense tbody tr:hover { background: var(--navy-10); }
.table-wrap { overflow-x: auto; }
.table-dense td.wrap, .table-dense th.wrap { white-space: normal; }
.table-dense a { text-decoration: none; font-weight: 600; }

/* ----------------------------- Badges / status pills ---------------------- */
.pill {
  display: inline-flex; align-items: center; gap: 5px; padding: 3px 9px; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700; line-height: 1.4; white-space: nowrap;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill-up, .pill-online, .pill-enabled, .pill-normal, .pill-completed { background: #e8f3e9; color: var(--success); }
.pill-down, .pill-offline, .pill-disabled, .pill-open, .pill-short, .pill-failed { background: #fdecea; color: var(--error); }
.pill-warning, .pill-rebooting, .pill-searching, .pill-running, .pill-abnormal { background: #fff6e0; color: var(--warning); }
.pill-neutral, .pill-unknown, .pill-not_run { background: var(--navy-10); color: var(--grey); }

/* ----------------------------- Buttons (small, table-inline) -------------- */
.btn-sm { padding: 5px 12px; font-size: 0.8rem; border-radius: var(--radius); }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-danger { background: var(--error); color: var(--white); border-color: var(--error); }
.btn-danger:hover { background: #8f1e18; }
.btn-ghost { background: transparent; color: var(--navy); border: 1px solid var(--line); }
.btn-ghost:hover { background: var(--navy-10); }

/* ----------------------------- Forms -------------------------------------- */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px 18px; }
.form-row { margin-bottom: 14px; }
.form-actions { margin-top: 18px; display: flex; gap: 10px; }
.help-text { font-size: 0.8rem; color: var(--grey); margin-top: 4px; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; margin: 0 0 16px; }
legend { font-family: var(--font-display); font-weight: 700; color: var(--navy); padding: 0 6px; }

/* ----------------------------- Port grid ---------------------------------- */
.port-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin-bottom: 22px; }
.port-tile { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; text-decoration: none; color: var(--ink); display: block; }
.port-tile:hover { border-color: var(--amber); box-shadow: var(--shadow-hover); }
.port-tile .pn { font-weight: 800; color: var(--navy); font-family: var(--font-display); }
.port-tile .meta { font-size: 0.76rem; color: var(--grey); margin-top: 2px; }
.port-tile.link-up { border-left: 4px solid var(--success); }
.port-tile.link-down { border-left: 4px solid var(--line); }
.port-tile.poe-active .meta { color: var(--amber-dark); font-weight: 700; }

/* ----------------------------- Login page --------------------------------- */
.login-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, var(--navy) 0%, #013d69 100%); }
.login-card { background: var(--white); border-radius: var(--radius-xl); box-shadow: 0 20px 50px rgba(0,0,0,0.3); padding: 36px 34px; width: 380px; }
.login-card img { height: 34px; margin-bottom: 18px; }
.login-card h1 { font-size: 1.25rem; }

/* ----------------------------- Misc ---------------------------------------- */
.text-muted { color: var(--grey); }
.mono { font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace; font-size: 0.85em; }
.mt-0 { margin-top: 0; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
