/* ================================================================
   GNOUGNOU MANAGER v0.7 - Microsoft 365 / Fluent 2 design
   Segoe UI, blue accents, light gray background, soft shadows
   ================================================================ */

/* -----------------------------------
   DESIGN TOKENS - Fluent 2
   ----------------------------------- */
:root {
  /* Neutral - Fluent grays */
  --neutral-grey-2: #050505;
  --neutral-grey-4: #0A0A0A;
  --neutral-grey-6: #0F0F0F;
  --neutral-grey-8: #141414;
  --neutral-grey-10: #1A1A1A;
  --neutral-grey-12: #1F1F1F;
  --neutral-grey-14: #242424;
  --neutral-grey-16: #292929;
  --neutral-grey-18: #2E2E2E;
  --neutral-grey-22: #383838;
  --neutral-grey-24: #3D3D3D;
  --neutral-grey-26: #424242;
  --neutral-grey-30: #4D4D4D;
  --neutral-grey-34: #575757;
  --neutral-grey-38: #616161;
  --neutral-grey-42: #6B6B6B;
  --neutral-grey-46: #757575;
  --neutral-grey-50: #808080;
  --neutral-grey-54: #8A8A8A;
  --neutral-grey-58: #949494;
  --neutral-grey-62: #9E9E9E;
  --neutral-grey-66: #A8A8A8;
  --neutral-grey-70: #B3B3B3;
  --neutral-grey-74: #BDBDBD;
  --neutral-grey-78: #C7C7C7;
  --neutral-grey-82: #D1D1D1;
  --neutral-grey-86: #DBDBDB;
  --neutral-grey-88: #E0E0E0;
  --neutral-grey-90: #E6E6E6;
  --neutral-grey-92: #EBEBEB;
  --neutral-grey-94: #F0F0F0;
  --neutral-grey-96: #F5F5F5;
  --neutral-grey-98: #FAFAFA;

  /* Brand - Microsoft Communication Blue (Fluent primary) */
  --brand-10: #061724;
  --brand-20: #082338;
  --brand-30: #0C3B5E;
  --brand-40: #0F548C;
  --brand-50: #115EA3;
  --brand-60: #0F6CBD;        /* Primary brand */
  --brand-70: #2886DE;
  --brand-80: #479EF5;
  --brand-90: #62ABF5;
  --brand-100: #77B7F7;
  --brand-110: #96C6FA;
  --brand-120: #B4D6FA;
  --brand-130: #CFE4FA;
  --brand-140: #EBF3FC;
  --brand-150: #F6FAFE;
  --brand-160: #FAFCFE;

  /* Semantic surface colors */
  --color-bg-canvas: #FAF9F8;        /* Page background */
  --color-bg-layer: #FFFFFF;          /* Card surface */
  --color-bg-layer-alpha: rgba(255, 255, 255, 0.7);
  --color-bg-subtle: #F5F5F5;        /* Subtle surface */
  --color-bg-subtle-2: #F0F0F0;      /* More subtle */
  --color-bg-disabled: #F0F0F0;

  /* Text */
  --color-text-primary: #242424;
  --color-text-secondary: #424242;
  --color-text-tertiary: #616161;
  --color-text-disabled: #BDBDBD;
  --color-text-on-brand: #FFFFFF;
  --color-text-link: var(--brand-70);

  /* Stroke */
  --color-stroke: #E0E0E0;
  --color-stroke-subtle: #EBEBEB;
  --color-stroke-strong: #BDBDBD;

  /* Status (Fluent shared) */
  --color-success: #107C10;
  --color-success-bg: #DFF6DD;
  --color-success-stroke: #92C353;
  --color-warning: #F7630C;
  --color-warning-bg: #FFF4CE;
  --color-warning-stroke: #F2C661;
  --color-danger: #D13438;
  --color-danger-bg: #FDE7E9;
  --color-danger-stroke: #F1707B;
  --color-info: var(--brand-60);
  --color-info-bg: var(--brand-140);

  /* Fluent shared colors for KPI tiles */
  --shared-blue: #0F6CBD;
  --shared-blue-bg: #EBF3FC;
  --shared-green: #107C10;
  --shared-green-bg: #DFF6DD;
  --shared-purple: #5C2E91;
  --shared-purple-bg: #F4ECFA;
  --shared-orange: #CA5010;
  --shared-orange-bg: #FFF4CE;
  --shared-teal: #038387;
  --shared-teal-bg: #E0F4F4;
  --shared-pink: #C239B3;
  --shared-pink-bg: #FCE4FB;

  /* Shape - Fluent corner radius (small, never big) */
  --r-none: 0;
  --r-small: 2px;
  --r-medium: 4px;
  --r-large: 6px;
  --r-xlarge: 8px;
  --r-circular: 9999px;

  /* Elevation - Fluent depth */
  --shadow-2: 0 0 2px rgba(0, 0, 0, 0.12), 0 1px 2px rgba(0, 0, 0, 0.14);
  --shadow-4: 0 0 2px rgba(0, 0, 0, 0.12), 0 2px 4px rgba(0, 0, 0, 0.14);
  --shadow-8: 0 0 2px rgba(0, 0, 0, 0.12), 0 4px 8px rgba(0, 0, 0, 0.14);
  --shadow-16: 0 0 2px rgba(0, 0, 0, 0.12), 0 8px 16px rgba(0, 0, 0, 0.14);
  --shadow-28: 0 0 8px rgba(0, 0, 0, 0.12), 0 14px 28px rgba(0, 0, 0, 0.20);

  /* Motion - Fluent durations */
  --duration-faster: 100ms;
  --duration-fast: 150ms;
  --duration-normal: 200ms;
  --duration-slow: 300ms;
  --curve-decelerate: cubic-bezier(0.1, 0.9, 0.2, 1);
  --curve-accelerate: cubic-bezier(0.7, 0, 1, 0.5);
  --curve-easy-ease: cubic-bezier(0.33, 0, 0.67, 1);

  /* Type - Fluent type ramp */
  --font-base: "Segoe UI", "Segoe UI Web (West European)", -apple-system, BlinkMacSystemFont, Roboto, "Helvetica Neue", sans-serif;
  --font-mono: ui-monospace, "Cascadia Code", "Cascadia Mono", "Consolas", monospace;

  /* Type ramp sizes */
  --fs-100: 10px;
  --fs-200: 12px;
  --fs-300: 14px;        /* body */
  --fs-400: 16px;
  --fs-500: 20px;
  --fs-600: 24px;
  --fs-700: 28px;        /* hero subtitles */
  --fs-800: 32px;
  --fs-900: 40px;        /* page title */
  --fs-1000: 68px;       /* huge hero */

  --fw-regular: 400;
  --fw-medium: 500;
  --fw-semibold: 600;
  --fw-bold: 700;
}

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

html {
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  color-scheme: light;
}

body {
  margin: 0;
  font-family: var(--font-base);
  font-size: var(--fs-300);
  line-height: 1.42857;
  color: var(--color-text-primary);
  background: var(--color-bg-canvas);
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

p { margin: 0; }
button { font-family: var(--font-base); }

/* -----------------------------------
   APP SHELL - M365 layout
   ----------------------------------- */
.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 56px 1fr;
  grid-template-rows: 48px 1fr;
  grid-template-areas: "appbar appbar" "rail main";
}

@media (max-width: 700px) {
  .app-shell {
    grid-template-columns: 1fr;
    grid-template-rows: 48px 1fr;
    grid-template-areas: "appbar" "main";
  }
}

/* -----------------------------------
   TOP APP BAR (Microsoft style)
   ----------------------------------- */
.appbar {
  grid-area: appbar;
  background: var(--brand-60);
  color: white;
  display: flex;
  align-items: center;
  padding: 0 8px 0 16px;
  position: sticky;
  top: 0;
  z-index: 100;
  height: 48px;
  box-shadow: var(--shadow-2);
}

.appbar__brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: white;
  flex-shrink: 0;
}

.appbar__logo {
  width: 28px;
  height: 28px;
  border-radius: var(--r-medium);
  background: white;
  padding: 2px;
  object-fit: contain;
  flex-shrink: 0;
}

.appbar__title {
  font-size: var(--fs-400);
  font-weight: var(--fw-semibold);
  color: white;
  letter-spacing: -0.005em;
}

@media (max-width: 500px) {
  .appbar__title { font-size: var(--fs-300); }
}

.appbar__sep {
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.3);
  margin: 0 14px;
}

.appbar__app {
  font-size: var(--fs-300);
  color: rgba(255, 255, 255, 0.92);
}

@media (max-width: 700px) {
  .appbar__sep, .appbar__app { display: none; }
}

.appbar__spacer { flex: 1; }

.appbar__icon-btn {
  width: 40px;
  height: 40px;
  border-radius: var(--r-medium);
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background var(--duration-fast) var(--curve-easy-ease);
  text-decoration: none;
  font-size: 14px;
  position: relative;
}

.appbar__icon-btn:hover {
  background: rgba(255, 255, 255, 0.16);
}

.appbar__icon-btn .badge-dot {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--color-warning);
  border: 2px solid var(--brand-60);
}

.appbar__user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px 4px 4px;
  margin-left: 4px;
  background: transparent;
  border-radius: var(--r-circular);
  text-decoration: none;
  color: white;
  transition: background var(--duration-fast) var(--curve-easy-ease);
}
.appbar__user:hover { background: rgba(255, 255, 255, 0.16); }

.appbar__user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-30);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-200);
  flex-shrink: 0;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

.appbar__user-name {
  font-size: var(--fs-200);
  font-weight: var(--fw-semibold);
  color: white;
}
@media (max-width: 700px) { .appbar__user-name { display: none; } }

/* -----------------------------------
   LEFT NAV RAIL (vertical icons)
   ----------------------------------- */
.rail {
  grid-area: rail;
  background: var(--color-bg-layer);
  border-right: 1px solid var(--color-stroke);
  padding: 8px 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

@media (max-width: 700px) {
  .rail { display: none; }
}

.rail__link {
  width: 48px;
  height: 48px;
  border-radius: var(--r-medium);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  text-decoration: none;
  color: var(--color-text-secondary);
  transition: var(--duration-fast) var(--curve-easy-ease);
  position: relative;
  padding: 0 4px;
}

.rail__link:hover { background: var(--color-bg-subtle); }

.rail__link.active {
  color: var(--brand-60);
  font-weight: var(--fw-semibold);
}

.rail__link.active::before {
  content: '';
  position: absolute;
  left: -4px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: var(--brand-60);
  border-radius: 0 2px 2px 0;
}

.rail__link-icon {
  font-size: 18px;
  line-height: 1;
}

.rail__link-label {
  font-size: 9px;
  font-weight: var(--fw-medium);
  letter-spacing: 0;
  text-align: center;
  line-height: 1.1;
}

.rail__link-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  background: var(--color-danger);
  color: white;
  font-size: 9px;
  font-weight: var(--fw-bold);
  padding: 0 5px;
  border-radius: var(--r-circular);
  min-width: 14px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid white;
}

.rail__spacer { flex: 1; }

/* -----------------------------------
   MOBILE HAMBURGER MENU (only on mobile)
   ----------------------------------- */
.appbar__hamburger {
  display: none;
  width: 40px;
  height: 40px;
  border-radius: var(--r-medium);
  background: transparent;
  border: none;
  color: white;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  margin-right: 4px;
  font-size: 20px;
}

.appbar__hamburger:hover { background: rgba(255, 255, 255, 0.16); }

@media (max-width: 700px) {
  .appbar__hamburger { display: flex; }
}

.menu-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(0, 0, 0, 0.4);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--duration-normal) var(--curve-easy-ease);
}
.menu-overlay.open { opacity: 1; pointer-events: auto; }

.menu-panel {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 201;
  width: min(280px, 85vw);
  background: var(--color-bg-layer);
  box-shadow: var(--shadow-16);
  transform: translateX(-100%);
  transition: transform var(--duration-slow) var(--curve-decelerate);
  display: flex;
  flex-direction: column;
  padding: 12px 8px;
}
.menu-panel.open { transform: translateX(0); }

.menu-panel__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 8px 12px;
  margin-bottom: 8px;
  border-bottom: 1px solid var(--color-stroke);
}
.menu-panel__title {
  font-size: var(--fs-400);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
}
.menu-panel__close {
  width: 32px;
  height: 32px;
  border-radius: var(--r-medium);
  border: none;
  background: transparent;
  color: var(--color-text-secondary);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.menu-panel__close:hover { background: var(--color-bg-subtle); }

.menu-panel__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.menu-panel__link {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: var(--r-medium);
  color: var(--color-text-primary);
  text-decoration: none;
  font-size: var(--fs-300);
  font-weight: var(--fw-medium);
  transition: var(--duration-fast) var(--curve-easy-ease);
}

.menu-panel__link:hover { background: var(--color-bg-subtle); }

.menu-panel__link.active {
  background: var(--brand-140);
  color: var(--brand-60);
  font-weight: var(--fw-semibold);
}

.menu-panel__link-icon {
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.menu-panel__link-badge {
  margin-left: auto;
  background: var(--color-danger);
  color: white;
  font-size: 10px;
  font-weight: var(--fw-bold);
  padding: 1px 7px;
  border-radius: var(--r-circular);
  min-width: 18px;
  text-align: center;
}

/* -----------------------------------
   MAIN CONTENT
   ----------------------------------- */
.main {
  grid-area: main;
  padding: 24px 32px 48px;
  max-width: 100%;
  overflow-x: hidden;
}

@media (max-width: 700px) {
  .main { padding: 16px 16px 32px; }
}

/* -----------------------------------
   PAGE HEADER (M365 style)
   ----------------------------------- */
.page-header {
  margin-bottom: 24px;
}

.page-header__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.page-title {
  font-family: var(--font-base);
  font-size: var(--fs-700);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.02em;
  line-height: 1.2;
  color: var(--color-text-primary);
  margin: 0 0 4px;
}

@media (max-width: 700px) {
  .page-title { font-size: var(--fs-600); }
}

.page-subtitle {
  color: var(--color-text-secondary);
  font-size: var(--fs-300);
  line-height: 1.45;
}

.page-header__meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-200);
  color: var(--color-text-tertiary);
  margin-top: 8px;
  flex-wrap: wrap;
}

.page-header__meta .sep {
  display: inline-block;
  width: 3px; height: 3px;
  background: var(--color-text-disabled);
  border-radius: 50%;
}

.page-header__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* -----------------------------------
   STORY BANNER (MessageBar in Fluent)
   ----------------------------------- */
.story-banner {
  background: var(--color-bg-layer);
  border: 1px solid var(--color-stroke);
  border-left: 4px solid var(--brand-60);
  border-radius: var(--r-large);
  padding: 14px 18px;
  margin-bottom: 16px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 14px;
  align-items: center;
  box-shadow: var(--shadow-2);
}

.story-banner__icon {
  width: 32px; height: 32px;
  border-radius: var(--r-medium);
  background: var(--brand-140);
  color: var(--brand-60);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: var(--fw-semibold);
  flex-shrink: 0;
}

.story-banner__content { min-width: 0; }
.story-banner__title {
  font-size: var(--fs-400);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
  margin-bottom: 2px;
}
.story-banner__sub {
  font-size: var(--fs-300);
  color: var(--color-text-secondary);
  line-height: 1.45;
}

.story-banner__illustration {
  width: 64px;
  height: auto;
  opacity: 0.85;
  flex-shrink: 0;
}

@media (max-width: 700px) {
  .story-banner { grid-template-columns: 1fr; gap: 10px; }
  .story-banner__illustration { display: none; }
}

/* -----------------------------------
   KPI HERO (huge serif numbers per spec)
   ----------------------------------- */
.kpi-hero {
  background: var(--color-bg-layer);
  border: 1px solid var(--color-stroke);
  border-radius: var(--r-xlarge);
  padding: 28px 32px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-2);
}

.kpi-hero__layout {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 32px;
  align-items: center;
}

@media (max-width: 900px) {
  .kpi-hero { padding: 20px; }
  .kpi-hero__layout { grid-template-columns: 1fr; gap: 20px; }
}

.kpi-hero__label {
  font-size: var(--fs-200);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
  margin-bottom: 12px;
}

.kpi-hero__value {
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(48px, 7vw, 80px);
  font-weight: 400;
  line-height: 1;
  letter-spacing: -0.03em;
  color: var(--color-text-primary);
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.kpi-hero__currency {
  font-size: 0.32em;
  font-weight: 400;
  color: var(--color-text-tertiary);
  letter-spacing: 0;
  font-style: italic;
}

.kpi-hero__delta {
  margin-top: 14px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--r-medium);
  font-size: var(--fs-300);
  font-weight: var(--fw-semibold);
  border: 1px solid;
}

.kpi-hero__delta.up {
  background: var(--color-success-bg);
  color: var(--color-success);
  border-color: var(--color-success-stroke);
}

.kpi-hero__delta.down {
  background: var(--color-danger-bg);
  color: var(--color-danger);
  border-color: var(--color-danger-stroke);
}

.kpi-hero__story {
  padding: 16px 18px;
  background: var(--brand-150);
  border-radius: var(--r-medium);
  border: 1px solid var(--brand-130);
}

.kpi-hero__story-label {
  font-size: var(--fs-200);
  font-weight: var(--fw-bold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--brand-50);
  margin-bottom: 6px;
}

.kpi-hero__story-text {
  font-size: var(--fs-300);
  line-height: 1.5;
  color: var(--color-text-primary);
}
.kpi-hero__story-text strong { font-weight: var(--fw-semibold); }
.kpi-hero__story-text em { font-style: normal; font-weight: var(--fw-semibold); color: var(--brand-50); }

/* -----------------------------------
   KPI GRID - Fluent 2 cards (tile style)
   ----------------------------------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--color-bg-layer);
  border: 1px solid var(--color-stroke);
  border-radius: var(--r-large);
  padding: 18px 20px;
  box-shadow: var(--shadow-2);
  transition: all var(--duration-fast) var(--curve-easy-ease);
}

.kpi-card:hover {
  box-shadow: var(--shadow-4);
  border-color: var(--color-stroke-strong);
}

.kpi-card__label {
  font-size: var(--fs-200);
  font-weight: var(--fw-semibold);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.kpi-card__icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: var(--fw-semibold);
  background: var(--color-bg-subtle);
  color: var(--color-text-secondary);
}

.kpi-card[data-accent="blue"] .kpi-card__icon { background: var(--shared-blue-bg); color: var(--shared-blue); }
.kpi-card[data-accent="green"] .kpi-card__icon { background: var(--shared-green-bg); color: var(--shared-green); }
.kpi-card[data-accent="purple"] .kpi-card__icon { background: var(--shared-purple-bg); color: var(--shared-purple); }
.kpi-card[data-accent="orange"] .kpi-card__icon { background: var(--shared-orange-bg); color: var(--shared-orange); }
.kpi-card[data-accent="teal"] .kpi-card__icon { background: var(--shared-teal-bg); color: var(--shared-teal); }
.kpi-card[data-accent="pink"] .kpi-card__icon { background: var(--shared-pink-bg); color: var(--shared-pink); }

.kpi-card__value {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 32px;
  font-weight: 400;
  letter-spacing: -0.02em;
  color: var(--color-text-primary);
  line-height: 1;
}

.kpi-card__sub {
  margin-top: 6px;
  font-size: var(--fs-200);
  color: var(--color-text-tertiary);
  line-height: 1.4;
}
.kpi-card__sub strong { color: var(--color-text-primary); font-weight: var(--fw-semibold); }

/* -----------------------------------
   PANELS (Fluent surface)
   ----------------------------------- */
.panel {
  background: var(--color-bg-layer);
  border: 1px solid var(--color-stroke);
  border-radius: var(--r-large);
  padding: 20px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-2);
}

@media (max-width: 700px) { .panel { padding: 16px; } }

.panel__header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--color-stroke-subtle);
}

.panel__title {
  font-size: var(--fs-500);
  font-weight: var(--fw-semibold);
  letter-spacing: -0.005em;
  color: var(--color-text-primary);
  margin: 0;
}

.panel__sub {
  margin-top: 2px;
  font-size: var(--fs-200);
  color: var(--color-text-tertiary);
}

.panel__action {
  font-size: var(--fs-200);
  font-weight: var(--fw-semibold);
  color: var(--brand-60);
  text-decoration: none;
  padding: 4px 10px;
  border-radius: var(--r-medium);
  transition: var(--duration-fast);
}
.panel__action:hover { background: var(--brand-140); }

/* -----------------------------------
   GRID LAYOUTS
   ----------------------------------- */
.grid-2 {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.grid-half {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 900px) {
  .grid-2, .grid-half { grid-template-columns: 1fr; gap: 12px; }
}

/* -----------------------------------
   CHARTS
   ----------------------------------- */
.chart-container { position: relative; height: 280px; }
.chart-container.tall { height: 320px; }
.chart-container.short { height: 200px; }

/* -----------------------------------
   RANKED LIST
   ----------------------------------- */
.ranked-list { display: flex; flex-direction: column; gap: 2px; }

.ranked-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: var(--r-medium);
  transition: background var(--duration-fast);
}

.ranked-item:hover { background: var(--color-bg-subtle); }

.ranked-item__rank {
  width: 24px;
  height: 24px;
  border-radius: var(--r-medium);
  background: var(--color-bg-subtle);
  color: var(--color-text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--fs-200);
  font-weight: var(--fw-bold);
  flex-shrink: 0;
}

.ranked-item:nth-child(1) .ranked-item__rank {
  background: var(--shared-orange-bg);
  color: var(--shared-orange);
}

.ranked-item__avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--brand-60);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: var(--fw-semibold);
  font-size: var(--fs-200);
  flex-shrink: 0;
}

.ranked-item__info { flex: 1; min-width: 0; }
.ranked-item__name {
  font-weight: var(--fw-semibold);
  font-size: var(--fs-300);
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ranked-item__sub {
  font-size: var(--fs-200);
  color: var(--color-text-tertiary);
  margin-top: 1px;
}

.ranked-item__value {
  font-family: Georgia, "Times New Roman", serif;
  font-weight: 500;
  font-size: var(--fs-500);
  color: var(--color-text-primary);
  white-space: nowrap;
  letter-spacing: -0.01em;
}

/* -----------------------------------
   TABLES (Fluent DataGrid)
   ----------------------------------- */
.table-wrap { overflow-x: auto; }

table.gn {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--fs-300);
}

table.gn thead th {
  text-align: left;
  padding: 8px 12px;
  font-size: var(--fs-200);
  font-weight: var(--fw-semibold);
  color: var(--color-text-secondary);
  border-bottom: 1px solid var(--color-stroke);
  background: var(--color-bg-canvas);
  white-space: nowrap;
}

table.gn tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--color-stroke-subtle);
  vertical-align: middle;
  color: var(--color-text-primary);
}

table.gn tbody tr {
  transition: background var(--duration-fast);
  cursor: pointer;
}

table.gn tbody tr:hover { background: var(--color-bg-subtle); }
table.gn tbody tr:last-child td { border-bottom: none; }

.t-num {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

.t-mono {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
}

.t-eyebrow {
  font-size: var(--fs-200);
  font-weight: var(--fw-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-text-tertiary);
}

/* -----------------------------------
   BADGES (Fluent style)
   ----------------------------------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: var(--r-circular);
  font-size: var(--fs-100);
  font-weight: var(--fw-semibold);
  border: 1px solid transparent;
  height: 20px;
  letter-spacing: 0.02em;
}

.badge-ok { background: var(--color-success-bg); color: var(--color-success); border-color: var(--color-success-stroke); }
.badge-warn { background: var(--color-warning-bg); color: var(--color-warning); border-color: var(--color-warning-stroke); }
.badge-bad { background: var(--color-danger-bg); color: var(--color-danger); border-color: var(--color-danger-stroke); }
.badge-info { background: var(--color-info-bg); color: var(--color-info); border-color: var(--brand-130); }
.badge-neutral { background: var(--color-bg-subtle); color: var(--color-text-secondary); border-color: var(--color-stroke); }

.badge::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.badge-live::before { animation: live-pulse 1.5s infinite; }

@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(209, 52, 56, 0.4); }
  50% { box-shadow: 0 0 0 4px rgba(209, 52, 56, 0); }
}

/* -----------------------------------
   BUTTONS (Fluent button)
   ----------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-family: var(--font-base);
  font-size: var(--fs-300);
  font-weight: var(--fw-semibold);
  border-radius: var(--r-medium);
  border: 1px solid transparent;
  cursor: pointer;
  text-decoration: none;
  transition: all var(--duration-fast) var(--curve-easy-ease);
  white-space: nowrap;
  background: var(--color-bg-layer);
  color: var(--color-text-primary);
  height: 32px;
  min-width: 64px;
  justify-content: center;
}

.btn-primary {
  background: var(--brand-60);
  color: white;
  border-color: var(--brand-60);
}
.btn-primary:hover { background: var(--brand-50); border-color: var(--brand-50); }
.btn-primary:active { background: var(--brand-40); border-color: var(--brand-40); }

.btn-ghost {
  background: var(--color-bg-layer);
  color: var(--color-text-primary);
  border-color: var(--color-stroke);
}
.btn-ghost:hover { background: var(--color-bg-subtle); }

.btn-subtle {
  background: transparent;
  color: var(--color-text-primary);
  border-color: transparent;
}
.btn-subtle:hover { background: var(--color-bg-subtle); }

.btn-icon { padding: 0; width: 32px; min-width: 32px; justify-content: center; }
.btn-sm { padding: 3px 10px; font-size: var(--fs-200); height: 26px; }

/* -----------------------------------
   ALERTS (Fluent MessageBar)
   ----------------------------------- */
.alert-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 18px;
  border-radius: var(--r-large);
  margin-bottom: 8px;
  background: var(--color-bg-layer);
  border: 1px solid var(--color-stroke);
  border-left-width: 4px;
  box-shadow: var(--shadow-2);
}

.alert-card[data-niveau="danger"] { border-left-color: var(--color-danger); }
.alert-card[data-niveau="warning"] { border-left-color: var(--color-warning); }
.alert-card[data-niveau="info"] { border-left-color: var(--brand-60); }

.alert-card__icon {
  width: 28px;
  height: 28px;
  border-radius: var(--r-medium);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  font-weight: var(--fw-bold);
  margin-top: 2px;
}

.alert-card[data-niveau="danger"] .alert-card__icon { background: var(--color-danger-bg); color: var(--color-danger); }
.alert-card[data-niveau="warning"] .alert-card__icon { background: var(--color-warning-bg); color: var(--color-warning); }
.alert-card[data-niveau="info"] .alert-card__icon { background: var(--brand-140); color: var(--brand-60); }

.alert-card__body { flex: 1; min-width: 0; }
.alert-card__title {
  font-size: var(--fs-300);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
  margin-bottom: 2px;
}
.alert-card__msg {
  font-size: var(--fs-300);
  line-height: 1.45;
  color: var(--color-text-secondary);
}
.alert-card__time {
  margin-top: 8px;
  font-size: var(--fs-200);
  color: var(--color-text-tertiary);
}

/* -----------------------------------
   FORMS (Fluent input)
   ----------------------------------- */
.form-field { display: flex; flex-direction: column; gap: 4px; }

.form-label {
  font-size: var(--fs-200);
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
}

.form-input {
  padding: 5px 10px;
  font-family: var(--font-base);
  font-size: var(--fs-300);
  color: var(--color-text-primary) !important;
  background: var(--color-bg-layer) !important;
  background-color: var(--color-bg-layer) !important;
  border: 1px solid var(--color-stroke-strong);
  border-bottom: 1px solid var(--color-text-secondary);
  border-radius: var(--r-medium);
  transition: var(--duration-fast) var(--curve-easy-ease);
  width: 100%;
  height: 32px;
  color-scheme: light only;
  -webkit-appearance: none;
  appearance: none;
}

.form-input:hover { border-color: var(--color-text-primary); }

.form-input:focus {
  outline: none;
  border-color: var(--brand-60);
  border-bottom-width: 2px;
  padding-bottom: 4px;
}

.form-input::placeholder { color: var(--color-text-tertiary) !important; opacity: 1; }

.form-input:-webkit-autofill,
.form-input:-webkit-autofill:hover,
.form-input:-webkit-autofill:focus {
  -webkit-text-fill-color: var(--color-text-primary);
  -webkit-box-shadow: 0 0 0 1000px var(--color-bg-layer) inset !important;
  transition: background-color 5000s ease-in-out 0s;
}

select.form-input {
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='12' viewBox='0 0 12 12' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M2.5 4.5l3.5 3.5 3.5-3.5' stroke='%23616161' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 28px;
}

/* -----------------------------------
   PROGRESS BAR (Fluent style)
   ----------------------------------- */
.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--color-bg-subtle-2);
  border-radius: var(--r-circular);
  overflow: hidden;
}

.progress-bar__fill {
  height: 100%;
  background: var(--brand-60);
  border-radius: inherit;
  transition: width var(--duration-slow) var(--curve-decelerate);
}

/* -----------------------------------
   FLASH (Fluent MessageBar)
   ----------------------------------- */
.flash-stack { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }

.flash {
  padding: 8px 14px;
  border-radius: var(--r-medium);
  background: var(--color-bg-layer);
  border: 1px solid var(--color-stroke);
  border-left: 4px solid;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: var(--fs-300);
  box-shadow: var(--shadow-2);
}

.flash.danger { border-left-color: var(--color-danger); background: var(--color-danger-bg); color: var(--color-danger); }
.flash.success { border-left-color: var(--color-success); background: var(--color-success-bg); color: var(--color-success); }
.flash.info { border-left-color: var(--brand-60); background: var(--brand-140); color: var(--brand-50); }

/* -----------------------------------
   FOOTER
   ----------------------------------- */
.footer {
  margin-top: 40px;
  padding: 16px 0 0;
  border-top: 1px solid var(--color-stroke-subtle);
  text-align: center;
  font-size: var(--fs-200);
  color: var(--color-text-tertiary);
}

.footer__divider {
  display: inline-block;
  width: 12px;
  height: 1px;
  background: var(--color-stroke);
  margin: 0 8px;
  vertical-align: middle;
}

/* -----------------------------------
   ANIMATIONS
   ----------------------------------- */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.anim-stack > * {
  animation: fadeUp var(--duration-slow) var(--curve-decelerate) backwards;
}
.anim-stack > *:nth-child(1) { animation-delay: 0ms; }
.anim-stack > *:nth-child(2) { animation-delay: 40ms; }
.anim-stack > *:nth-child(3) { animation-delay: 80ms; }
.anim-stack > *:nth-child(4) { animation-delay: 120ms; }
.anim-stack > *:nth-child(5) { animation-delay: 160ms; }
.anim-stack > *:nth-child(6) { animation-delay: 200ms; }
.anim-stack > *:nth-child(7) { animation-delay: 240ms; }
.anim-stack > *:nth-child(8) { animation-delay: 280ms; }

/* -----------------------------------
   UTILS
   ----------------------------------- */
.hide { display: none !important; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-muted { color: var(--color-text-tertiary); }
.text-primary { color: var(--brand-60); }
.text-success { color: var(--color-success); }
.text-bad { color: var(--color-danger); }
.text-warning { color: var(--color-warning); }

.spacer-sm { height: 8px; }
.spacer { height: 16px; }
.spacer-lg { height: 32px; }

::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--color-stroke);
  border-radius: var(--r-circular);
  border: 3px solid var(--color-bg-canvas);
}
::-webkit-scrollbar-thumb:hover { background: var(--color-stroke-strong); }

/* -----------------------------------
   LOGIN PAGE (Microsoft sign-in style)
   ----------------------------------- */
.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--color-bg-canvas);
  position: relative;
  overflow: hidden;
}

.login-page::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(135deg, var(--color-bg-canvas) 0%, var(--color-bg-canvas) 50%, var(--brand-150) 100%);
  pointer-events: none;
}

.login-card {
  background: var(--color-bg-layer);
  border: 1px solid var(--color-stroke);
  border-radius: var(--r-xlarge);
  padding: 44px 44px;
  width: 100%;
  max-width: 440px;
  box-shadow: var(--shadow-16);
  position: relative;
  z-index: 1;
}

.login-card__brand {
  margin-bottom: 24px;
}

.login-card__logo-img {
  width: 48px;
  height: 48px;
  margin: 0 0 16px;
  display: block;
  border-radius: var(--r-medium);
}

.login-card__title {
  font-size: 24px;
  font-weight: var(--fw-semibold);
  color: var(--color-text-primary);
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.2;
}

.login-card__subtitle {
  margin-top: 8px;
  font-size: var(--fs-300);
  color: var(--color-text-secondary);
  line-height: 1.5;
}

.login-card__sub {
  font-size: var(--fs-200);
  color: var(--color-text-tertiary);
  margin-top: 24px;
  text-align: center;
  padding-top: 20px;
  border-top: 1px solid var(--color-stroke-subtle);
}

/* -----------------------------------
   PWA INSTALL
   ----------------------------------- */
.pwa-install-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.16);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: var(--r-medium);
  font-family: var(--font-base);
  font-size: var(--fs-200);
  font-weight: var(--fw-semibold);
  cursor: pointer;
  transition: var(--duration-fast);
  height: 32px;
}
.pwa-install-btn:hover { background: rgba(255, 255, 255, 0.24); }

/* -----------------------------------
   DETAIL PAGES
   ----------------------------------- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
@media (max-width: 700px) {
  .detail-grid { grid-template-columns: 1fr; }
}

dl.detail-list {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 8px 24px;
  margin: 0;
  font-size: var(--fs-300);
}

dl.detail-list dt {
  font-size: var(--fs-200);
  color: var(--color-text-tertiary);
  font-weight: var(--fw-semibold);
  align-self: center;
}

dl.detail-list dd {
  margin: 0;
  color: var(--color-text-primary);
  font-weight: var(--fw-medium);
}

/* -----------------------------------
   RESPONSIVE
   ----------------------------------- */
@media (max-width: 700px) {
  .page-header { margin-bottom: 16px; }
  .page-header__top { flex-direction: column; align-items: stretch; gap: 8px; }
  .kpi-hero__value { font-size: clamp(40px, 12vw, 56px); }
  .kpi-card__value { font-size: 24px; }
  .panel__title { font-size: var(--fs-400); }
  .panel__header { flex-direction: column; align-items: flex-start; gap: 6px; }
  .chart-container { height: 220px; }
  .chart-container.tall { height: 260px; }
  table.gn { font-size: var(--fs-200); }
  table.gn thead th, table.gn tbody td { padding: 7px 10px; }
  .form-input { font-size: 16px; }
  .login-card { padding: 32px 24px; }
}

@media (max-width: 380px) { .kpi-grid { grid-template-columns: 1fr; } }

@supports (padding: max(0px)) {
  body { padding-left: env(safe-area-inset-left); padding-right: env(safe-area-inset-right); }
}

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