/* Philips dashboard — standalone stylesheet (no dependency on the host site). */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg: #F6F7FB;
  --surface: #FFFFFF;
  --surface-alt: #F1F3F8;
  --border: #E3E7EF;
  --text: #1B2333;
  --text-muted: #6B7280;
  --primary: #3454D1;
  --primary-ink: #28409E;
  --video: #0E9384;
  --danger: #B42318;
  --danger-bg: #FDEEEC;
  --warning: #9A5B00;
  --warning-bg: #FFF3DF;
  --shadow: 0 1px 2px rgba(20, 24, 38, 0.04), 0 1px 8px rgba(20, 24, 38, 0.04);
}

* { box-sizing: border-box; }
body {
  font-family: 'Inter', -apple-system, Segoe UI, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  margin: 0;
  -webkit-font-smoothing: antialiased;
}
h1 { font-weight: 700; letter-spacing: -0.015em; font-size: 26px; margin: 0 0 6px; }
h3 { font-weight: 600; font-size: 16px; margin: 22px 0 8px; }
.muted { color: var(--text-muted); font-size: 13px; }
code { background: var(--surface-alt); border: 1px solid var(--border); padding: 2px 6px; border-radius: 5px; font-size: 12px; }

/* --- Shell --- */
.app-shell { display: flex; min-height: 100vh; align-items: flex-start; }
.sidebar {
  width: 240px; flex-shrink: 0; background: var(--surface); border-right: 1px solid var(--border);
  min-height: 100vh; position: sticky; top: 0; display: flex; flex-direction: column; padding: 20px 0;
}
.sidebar .brand { display: flex; flex-direction: column; gap: 6px; padding: 0 20px 18px; margin-bottom: 8px; border-bottom: 1px solid var(--border); }
.sidebar .brand-logo { max-width: 150px; height: auto; display: block; }
.sidebar .brand-tagline { font-weight: 700; font-size: 13px; color: var(--text-muted); }
.sidebar .section-label { padding: 16px 20px 6px; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--text-muted); }
.sidebar nav a {
  display: block; padding: 9px 20px; color: var(--text-muted); text-decoration: none;
  font-size: 14px; font-weight: 500; border-left: 3px solid transparent;
}
.sidebar nav a:hover { background: var(--surface-alt); color: var(--text); }
.sidebar nav a.active { color: var(--primary); background: var(--surface-alt); border-left-color: var(--primary); font-weight: 600; }
.sidebar .sidebar-footer { margin-top: auto; padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar .user { display: block; padding: 0 20px 8px; font-size: 12.5px; color: var(--text-muted); }
.main-content { flex: 1; min-width: 0; }
.container { max-width: 1120px; margin: 0 auto; padding: 28px 24px 64px; }

/* --- Surfaces & controls --- */
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 22px; margin: 16px 0; box-shadow: var(--shadow); }
label { display: block; font-size: 12.5px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.02em; }
input, select {
  width: 100%; padding: 10px 12px; margin-top: 6px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--surface); color: var(--text); font-family: inherit; font-size: 14px;
}
input:focus, select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(52, 84, 209, 0.12); }
button {
  background: var(--primary); color: #fff; border: none; padding: 11px 20px; border-radius: 8px;
  cursor: pointer; font-size: 14px; font-weight: 600; font-family: inherit;
}
button:hover { background: var(--primary-ink); }
button.secondary { background: var(--surface); color: var(--text); border: 1px solid var(--border); font-weight: 500; padding: 7px 14px; font-size: 13px; }
button.secondary:hover { background: var(--surface-alt); }
.err { background: var(--danger-bg); border: 1px solid #F3C3BE; padding: 11px 14px; border-radius: 8px; margin-top: 10px; color: var(--danger); font-size: 14px; }
.warn-box { background: var(--warning-bg); border: 1px solid #F0DBA6; padding: 11px 14px; border-radius: 8px; margin-top: 10px; color: var(--warning); font-size: 14px; }

/* --- Filters --- */
.ph-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.ph-filters > div { min-width: 150px; }
.ph-filters .ph-campaign { flex: 1; min-width: 220px; }
.ph-filters button { height: 41px; }
.ph-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.ph-presets a { font-size: 12.5px; padding: 5px 11px; border: 1px solid var(--border); border-radius: 100px; color: var(--text); text-decoration: none; background: var(--surface); }
.ph-presets a:hover, .ph-presets a.on { border-color: var(--primary); color: var(--primary); }

/* --- Stat cards --- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 16px; margin-top: 18px; }
.card { background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--primary); border-radius: 10px; padding: 18px 20px; box-shadow: var(--shadow); min-width: 0; }
.card.video { border-left-color: var(--video); }
.card h3 { font-size: 24px; margin: 0 0 4px; font-weight: 700; font-variant-numeric: tabular-nums; }
.card p { margin: 0; color: var(--text-muted); font-size: 13px; font-weight: 500; }

/* --- Charts & sections --- */
.ph-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; margin-top: 16px; }
.ph-grid .panel { margin: 0; }
.ph-chart { position: relative; height: 300px; }
.ph-grid-even { grid-template-columns: 1fr 1fr; }
.ph-chart-sm { height: 230px; margin-top: 8px; }
.ph-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ph-head h3 { margin: 0; }
.ph-loading { padding: 48px 0; text-align: center; color: var(--text-muted); }
.ph-note { font-size: 12.5px; color: var(--text-muted); margin-top: 18px; }

/* --- Tables (DataTables) --- */
table.list { width: 100%; border-collapse: collapse; margin-top: 12px; }
.table-scroll { overflow-x: auto; }
.table-scroll table.dataTable { white-space: nowrap; }
table.dataTable thead th {
  background: var(--surface-alt); color: var(--text-muted); font-weight: 600; font-size: 12px;
  text-transform: uppercase; letter-spacing: 0.03em; border-bottom: 1px solid var(--border) !important; text-align: left;
}
table.dataTable tbody td { border-bottom: 1px solid var(--border); font-size: 13.5px; }
table.dataTable tbody tr:hover { background: var(--surface-alt); }
table.dataTable td.num, table.dataTable th.num { text-align: right; font-variant-numeric: tabular-nums; }
.dataTables_wrapper { margin-top: 10px; }
.dataTables_wrapper .dataTables_info { color: var(--text-muted); font-size: 13px; }
.dataTables_wrapper .dataTables_paginate .paginate_button { border-radius: 6px !important; border: 1px solid transparent !important; color: var(--text) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button.current { background: var(--primary) !important; color: #fff !important; border-color: var(--primary) !important; }
.dataTables_wrapper .dataTables_paginate .paginate_button:hover { background: var(--surface-alt) !important; border-color: var(--border) !important; color: var(--text) !important; }
.dt-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 10px; flex-wrap: wrap; }
.dt-toolbar label { display: inline-flex; align-items: center; gap: 8px; text-transform: none; font-weight: 500; font-size: 13px; letter-spacing: 0; }
.dt-toolbar input, .dt-toolbar select { width: auto; margin: 0; padding: 6px 10px; font-size: 13px; }
.dt-footer { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 12px; }

/* --- Login --- */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 380px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 34px 30px; box-shadow: var(--shadow); }
.login-card img { max-width: 160px; display: block; margin-bottom: 22px; }
.login-card h1 { font-size: 22px; }
.login-card .muted { margin: 0 0 20px; }
.login-card label { margin-top: 14px; }
.login-card button { width: 100%; margin-top: 22px; }

/* --- Small screens --- */
@media (max-width: 900px) { .ph-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .app-shell { flex-direction: column; align-items: stretch; }
  .sidebar { width: 100%; min-height: 0; position: static; flex-direction: row; align-items: center; justify-content: space-between; padding: 12px 16px; border-right: 0; border-bottom: 1px solid var(--border); }
  .sidebar .brand { padding: 0; margin: 0; border: 0; }
  .sidebar > nav { display: none; }
  .sidebar .sidebar-footer { margin: 0; padding: 0; border: 0; display: flex; align-items: center; }
  .sidebar .user { padding: 0 10px 0 0; }
  .sidebar .sidebar-footer nav a { padding: 6px 0; border: 0; }
  .container { padding: 20px 16px 48px; }
}
