/* ==========================================================================
   HipBEEs hive — design system
   Industrial "blueprint" theme: Barlow / Barlow Condensed, muted blue-grey
   with honey accents. Fonts are self-hosted so the CSP stays `font-src 'self'`
   (see public/.htaccess) — do NOT swap these for the Google Fonts CDN without
   updating the CSP and docs/security/annex-i-mapping.md.
   ========================================================================== */

/* --- Fonts: Barlow (body) ------------------------------------------------ */
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/barlow-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/barlow-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('fonts/barlow-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('fonts/barlow-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('fonts/barlow-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('fonts/barlow-600-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/barlow-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/barlow-700-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* --- Fonts: Barlow Condensed (headings) --------------------------------- */
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/barlowcond-400-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 400; font-display: swap;
  src: url('fonts/barlowcond-400-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('fonts/barlowcond-500-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 500; font-display: swap;
  src: url('fonts/barlowcond-500-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('fonts/barlowcond-600-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap;
  src: url('fonts/barlowcond-600-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/barlowcond-700-latin.woff2') format('woff2');
  unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap;
  src: url('fonts/barlowcond-700-latin-ext.woff2') format('woff2');
  unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF; }

/* --- Tokens ------------------------------------------------------------- */
:root {
    --color-bg: #f2f2f3;
    --color-surface: #e9e9ea;
    --color-panel: #ffffff;
    --color-text: #1d1f20;
    --color-accent: #5980a6;
    --color-divider: color-mix(in srgb, #1d1f20 16%, transparent);

    --color-neutral-100: #f5f5f8;
    --color-neutral-200: #e7e7ea;
    --color-neutral-300: #d4d4d7;
    --color-neutral-400: #b7b7ba;
    --color-neutral-500: #98989b;
    --color-neutral-600: #7a7a7d;
    --color-neutral-700: #5d5d60;
    --color-neutral-800: #424244;
    --color-neutral-900: #2b2b2d;

    --color-accent-100: #eef6ff;
    --color-accent-200: #d6ebff;
    --color-accent-300: #b5d9fd;
    --color-accent-400: #94bce3;
    --color-accent-500: #749dc4;
    --color-accent-600: #597ea3;
    --color-accent-700: #416180;
    --color-accent-800: #2c455d;
    --color-accent-900: #1d2d3d;

    /* Honey — reserved for the BEE brand mark and "online" emphasis. */
    --honey:       #dfa32e;
    --honey-dark:  #c98b1e;
    --honey-light: #ecb54e;
    --honey-deep:  #a06e15;

    --font-heading: 'Barlow Condensed', system-ui, sans-serif;
    --font-body: 'Barlow', system-ui, sans-serif;
    --font-mono: ui-monospace, 'SF Mono', 'Fira Code', Menlo, Consolas, monospace;

    --radius-sm: 2px;
    --radius-md: 4px;
    --radius-lg: 7px;

    --shadow-sm: 0 1px 2px color-mix(in srgb, #2b2b2d 14%, transparent);
    --shadow-md: 0 3px 10px color-mix(in srgb, #2b2b2d 16%, transparent);
    --shadow-lg: 0 12px 32px color-mix(in srgb, #2b2b2d 22%, transparent);

    --green: #3f7d58;
    --yellow: #b8862b;
    --red: #a63d3d;

    /* Legacy aliases — a handful of inline style="" attributes in the PHP
       templates still reference these. Kept mapped onto the new palette so
       nothing renders off-theme; prefer the tokens above in new markup. */
    --amber: var(--honey);
    --amber-dark: var(--honey-dark);
    --amber-light: #f7e6c4;
    --bg: var(--color-bg);
    --card: var(--color-panel);
    --text: var(--color-text);
    --text-muted: var(--color-neutral-600);
    --border: var(--color-divider);
}

/* --- Base --------------------------------------------------------------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font-body);
    background: var(--color-bg);
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.55;
}

h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    font-weight: 600;
    line-height: 1.12;
    letter-spacing: -0.015em;
}

a { color: var(--color-accent); text-decoration: none; text-underline-offset: 3px; }
a:hover { text-decoration: underline; }

:focus { outline: none; }
:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--color-accent) 30%, transparent); }

/* --- Blueprint frame ---------------------------------------------------- */
/* Technical-drawing crosshairs at the corners of a panel. Requires four
   <i class="corner tl|tr|bl|br"></i> children. */
.blueprint {
    position: relative;
    border: 1px solid var(--color-divider);
    border-radius: 0;
    background: var(--color-panel);
}
.blueprint > .corner {
    position: absolute; width: 11px; height: 11px;
    color: color-mix(in srgb, var(--color-text) 55%, transparent);
}
.blueprint > .corner::before,
.blueprint > .corner::after { content: ""; position: absolute; background: currentColor; }
.blueprint > .corner::before { left: 5px; top: 0; width: 1px; height: 100%; }
.blueprint > .corner::after  { top: 5px; left: 0; width: 100%; height: 1px; }
.blueprint > .corner.tl { top: -6px; left: -6px; }
.blueprint > .corner.tr { top: -6px; right: -6px; }
.blueprint > .corner.bl { bottom: -6px; left: -6px; }
.blueprint > .corner.br { bottom: -6px; right: -6px; }

/* --- Layout ------------------------------------------------------------- */
.layout { display: flex; min-height: 100vh; }

.sidebar {
    width: 248px;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    background-color: var(--color-accent-900);
    /* Honeycomb: closed cells on a 56x99 tile drawn 1:1, so the pattern
       tessellates seamlessly. Neighbour cells overhang the tile edges and
       meet their opposite copies exactly. */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='99' viewBox='0 0 56 99'%3E%3Cg fill='none' stroke='%23eef6ff' stroke-opacity='0.11'%3E%3Cpath d='M28 0L56 16.5L56 49.5L28 66L0 49.5L0 16.5Z'/%3E%3Cpath d='M0 49.5L28 66L28 99L0 115.5L-28 99L-28 66Z'/%3E%3Cpath d='M56 49.5L84 66L84 99L56 115.5L28 99L28 66Z'/%3E%3Cpath d='M0 -49.5L28 -33L28 0L0 16.5L-28 0L-28 -33Z'/%3E%3Cpath d='M56 -49.5L84 -33L84 0L56 16.5L28 0L28 -33Z'/%3E%3C/g%3E%3C/svg%3E");
    color: var(--color-accent-100);
    padding: 0;
}

/* Brand lockup: pictogram beside the wordmark + domain. */
.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 14px 16px;
    border-bottom: 1px solid color-mix(in srgb, var(--color-accent-100) 14%, transparent);
    margin-bottom: 4px;
}
.sidebar-brand > div { min-width: 0; }

.sidebar h1 {
    font-size: 24px;
    line-height: 1;
    padding: 0;
    color: var(--color-accent-100);
    border-bottom: none;
}
.sidebar h1 .bee { color: var(--honey-light); }

/* Wordmark subtitle, e.g. "hive.hipbees.de" */
.sidebar .brand-sub {
    font-size: 10px;
    letter-spacing: 0.22em;
    text-transform: uppercase;
    color: var(--color-accent-400);
    display: block;
    margin-top: 3px;
}

.sidebar nav { padding: 14px 10px; display: flex; flex-direction: column; gap: 2px; }

.sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    color: var(--color-accent-300);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 16px;
    letter-spacing: 0.02em;
    border-left: 2px solid transparent;
}

.sidebar nav a:hover,
.sidebar nav a.active {
    color: var(--color-accent-100);
    background: color-mix(in srgb, var(--color-accent-400) 22%, transparent);
    text-decoration: none;
}
.sidebar nav a.active {
    border-left-color: var(--honey);
    padding-left: 12px;
}

/* Sidebar footer: legal / sign-out, then identity + language. */
.sidebar-foot {
    margin-top: auto;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.sidebar-foot hr {
    border: none;
    border-top: 1px solid color-mix(in srgb, var(--color-accent-100) 14%, transparent);
    margin: 0;
}
.sidebar-links { display: flex; gap: 10px; align-items: center; }
.sidebar-links form { display: inline; }
.sidebar-links a,
.sidebar-links button {
    font-family: var(--font-body);
    font-size: 13px;
    color: var(--color-accent-300);
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    text-decoration: none;
}
.sidebar-links a:hover,
.sidebar-links button:hover { color: var(--color-accent-100); text-decoration: underline; }
.sidebar-links a.active { color: var(--honey-light); font-weight: 600; }

.sidebar-user { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-user-id { min-width: 0; }
.sidebar-user-id .name {
    display: block;
    font-weight: 600;
    font-size: 14px;
    color: var(--color-accent-100);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user-id .mail {
    display: block;
    font-size: 12px;
    color: var(--color-accent-400);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.sidebar-user .lang-switcher { margin-bottom: 0; flex-shrink: 0; }

.main {
    flex: 1;
    padding: 28px;
    max-width: 1280px;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.main h2 { font-size: 34px; margin-bottom: 0; }

/* Kicker above a page title */
.page-kicker {
    font-size: 11px;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--color-accent-700);
}

/* --- Hex stat tiles ----------------------------------------------------- */
/* Overlapping honeycomb cells. Markup:
   <div class="hexrow"><div class="hex"><b>2</b><span>GERÄTE</span></div>…</div> */
.hexrow { display: flex; align-items: center; }
.hexrow > * + * { margin-left: -20px; }

/* The outline is drawn as an inline SVG rather than a border, because a
   clip-path would shave a real border down to a hairline on the diagonals. */
.hex {
    width: 104px; height: 104px;
    display: inline-flex; flex-direction: column;
    align-items: center; justify-content: center;
    text-align: center; line-height: 1.15;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'%3E%3Cpolygon points='60,4 108.5,32 108.5,88 60,116 11.5,88 11.5,32' fill='none' stroke='%23597ea3' stroke-width='1.5'/%3E%3C/svg%3E");
    background-size: 100% 100%;
    background-repeat: no-repeat;
    border: 0;
}
.hex b {
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 34px;
    line-height: 1;
    color: var(--color-text);
}
.hex b.sm { font-size: 26px; }
.hex span {
    font-family: var(--font-body);
    font-size: 11px;
    letter-spacing: 1.5px;
    text-transform: uppercase;
    color: var(--color-accent-700);
    margin-top: 4px;
}
/* Honey-filled variant for the "online" cell. */
.hex.hex-honey {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 120 120'%3E%3Cpolygon points='60,4 108.5,32 108.5,88 60,116 11.5,88 11.5,32' fill='%23dfa32e' fill-opacity='0.12' stroke='%23c98b1e' stroke-width='1.5'/%3E%3C/svg%3E");
}
.hex.hex-honey span { color: var(--honey-deep); }

/* Hexagonal action button that sits in the same row. */
.hex-btn {
    width: 104px; height: 104px; padding: 0; border: 0; cursor: pointer;
    clip-path: polygon(50% 3.3%, 90.4% 26.7%, 90.4% 73.3%, 50% 96.7%, 9.6% 73.3%, 9.6% 26.7%);
    background: var(--color-accent);
    color: var(--color-bg);
    display: inline-flex; flex-direction: column;
    align-items: center; justify-content: center; gap: 3px;
    font-family: var(--font-heading); font-weight: 600; font-size: 14px;
    line-height: 1.15; text-align: center;
}
.hex-btn:hover { background: var(--color-accent-600); text-decoration: none; }

/* --- Cards -------------------------------------------------------------- */
.stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 14px;
}

.card {
    background: var(--color-panel);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

.card .label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--color-accent-700);
    letter-spacing: 0.1em;
}

.card .value {
    font-family: var(--font-heading);
    font-size: 32px;
    font-weight: 600;
    line-height: 1.1;
    margin-top: 2px;
}

/* --- Tables ------------------------------------------------------------- */
table {
    width: 100%;
    border-collapse: collapse;
    background: var(--color-panel);
    border: 1px solid var(--color-divider);
    border-radius: 0;
    overflow: hidden;
    font-size: 14px;
}

th, td { padding: 9px 12px; text-align: left; }

th {
    background: transparent;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 11px;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: color-mix(in srgb, var(--color-text) 60%, transparent);
    border-bottom: 1px solid var(--color-divider);
}

td { border-bottom: 1px solid color-mix(in srgb, var(--color-text) 8%, transparent); }

tbody tr:hover { background: color-mix(in srgb, var(--color-text) 4%, transparent); }
tr:last-child td { border-bottom: none; }

/* Monospace cells for MAC / IP / keys. */
td.mono, .mono { font-family: var(--font-mono); font-size: 13px; }
td.dim { font-size: 13px; color: var(--color-neutral-700); }

/* --- Status dots -------------------------------------------------------- */
.dot {
    display: inline-block;
    width: 7px; height: 7px;
    border-radius: 50%;
    margin-right: 0.5rem;
}
.dot-green  { background: var(--green); }
.dot-yellow { background: var(--yellow); }
.dot-red    { background: var(--red); }

/* --- Badges ------------------------------------------------------------- */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    font-size: 11px;
    letter-spacing: 0.02em;
    font-weight: 500;
}
.badge-sent       { background: #dcebe2; color: #27543a; }
.badge-failed     { background: #f2dede; color: #7d2b2b; }
.badge-queued     { background: #f7e6c4; color: #7a5410; }
.badge-admin      { background: #f7e6c4; color: #7a5410; }
.badge-viewer     { background: var(--color-neutral-200); color: var(--color-neutral-800); }
.badge-pending    { background: #f7e6c4; color: #7a5410; }
.badge-enabled    { background: var(--color-accent-100); color: var(--color-accent-800); }
.badge-registered { background: #dcebe2; color: #27543a; }
.badge-blocked    { background: #f2dede; color: #7d2b2b; }
.badge-verified   { background: #dcebe2; color: #27543a; }
.badge-unverified { background: #f7e6c4; color: #7a5410; }
.badge-danger     { background: #f2dede; color: #7d2b2b; }

/* --- Buttons ------------------------------------------------------------ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 7px 13px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: var(--font-heading);
    font-weight: 600;
    font-size: 14px;
    line-height: 1.2;
    cursor: pointer;
    text-align: center;
    color: var(--color-text);
    background: transparent;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn:hover { text-decoration: none; }

.btn-primary { background: var(--color-accent); color: var(--color-bg); }
.btn-primary:hover { background: var(--color-accent-600); }
.btn-primary:active { background: var(--color-accent-700); }

.btn-outline { background: transparent; border-color: var(--color-divider); color: var(--color-text); }
.btn-outline:hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); }

.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #8f3333; }

.btn-sm { padding: 4px 10px; font-size: 12px; }

.actions-cell { white-space: nowrap; }
.actions-cell .btn { margin-right: 0.25rem; }

/* Icon buttons are honeycomb cells. Pointy-top hexagon on a 32x37 box — the
   same 56:66 proportion as the background comb, with shoulders at 25%/75%.
   Icon-only by definition: a label will not fit inside the clip. */
.btn-icon {
    display: inline-flex; align-items: center; justify-content: center;
    width: 32px; height: 37px; min-width: 32px; padding: 0;
    border: 0; border-radius: 0;
    clip-path: polygon(50% 0%, 100% 25%, 100% 75%, 50% 100%, 0% 75%, 0% 25%);
    background: var(--color-surface);
    color: var(--color-text);
    cursor: pointer; font-size: 0.95rem; line-height: 1;
    margin-right: 3px; vertical-align: middle;
}
.btn-icon:hover { background: var(--color-neutral-300); text-decoration: none; }
.btn-icon svg { display: block; }

/* clip-path also clips the focus ring, so focus is shown as a filled cell
   rather than an outline — otherwise keyboard focus would be invisible. */
.btn-icon:focus-visible {
    outline: none;
    background: var(--color-accent);
    color: var(--color-bg);
}

.btn-icon-ok      { background: #dcebe2; color: #27543a; }
.btn-icon-ok:hover{ background: #c9e0d3; }
.btn-icon-warn    { background: #f7e6c4; color: #7a5410; }
.btn-icon-warn:hover { background: #f0d9a8; }
.btn-icon-danger  { background: var(--red); color: #fff; }
.btn-icon-danger:hover { background: #8f3333; }
.btn-icon-accent  { background: var(--color-accent); color: var(--color-bg); }
.btn-icon-accent:hover { background: var(--color-accent-600); }
/* Non-interactive cell (e.g. "reset pending"), rendered as a <span>. */
.btn-icon-muted { background: var(--color-neutral-200); color: var(--color-neutral-600); cursor: default; }
.btn-icon-muted:hover { background: var(--color-neutral-200); }

/* --- Forms -------------------------------------------------------------- */
.form-group { margin-bottom: 1rem; }

.form-group label {
    display: block;
    font-size: 12px;
    margin-bottom: 5px;
    color: color-mix(in srgb, var(--color-text) 70%, transparent);
}

input[type="text"],
input[type="email"],
input[type="password"],
input[type="tel"],
input[type="file"],
select,
textarea {
    width: 100%;
    min-height: 36px;
    padding: 6px 10px;
    font-family: inherit;
    font-size: 14px;
    color: var(--color-text);
    caret-color: var(--color-accent);
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-md);
}

input:hover, select:hover, textarea:hover {
    border-color: color-mix(in srgb, var(--color-text) 45%, transparent);
}

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

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--color-accent);
    box-shadow: none;
}

/* --- Alerts ------------------------------------------------------------- */
.alert {
    padding: 10px 13px;
    border-radius: var(--radius-md);
    margin-bottom: 1rem;
    font-size: 14px;
}
.alert-error   { background: #f2dede; color: #7d2b2b; border: 1px solid #e3c4c4; }
.alert-success { background: #dcebe2; color: #27543a; border: 1px solid #c1dccd; }

/* --- Pagination --------------------------------------------------------- */
.pagination { margin-top: 1rem; display: flex; gap: 0.5rem; }

.pagination a, .pagination span {
    padding: 5px 11px;
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-sm);
    font-size: 13px;
}
.pagination span { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-bg); }

/* --- Login -------------------------------------------------------------- */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 28px;
    background-color: var(--color-bg);
    /* Same tessellation as the sidebar, drawn larger (84x148.5 from a 56x99
       viewBox) and in the accent; the centre cell carries a faint honey wash
       instead of the old separate floating hexagon. */
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='84' height='148.5' viewBox='0 0 56 99'%3E%3Cg fill='none' stroke='%235980a6' stroke-opacity='0.16'%3E%3Cpath d='M28 0L56 16.5L56 49.5L28 66L0 49.5L0 16.5Z' fill='%23dfa32e' fill-opacity='0.05'/%3E%3Cpath d='M0 49.5L28 66L28 99L0 115.5L-28 99L-28 66Z'/%3E%3Cpath d='M56 49.5L84 66L84 99L56 115.5L28 99L28 66Z'/%3E%3Cpath d='M0 -49.5L28 -33L28 0L0 16.5L-28 0L-28 -33Z'/%3E%3Cpath d='M56 -49.5L84 -33L84 0L56 16.5L28 0L28 -33Z'/%3E%3C/g%3E%3C/svg%3E");
}

.login-box {
    position: relative;
    background: var(--color-bg);
    border: 1px solid var(--color-divider);
    border-radius: 0;
    box-shadow: var(--shadow-md);
    padding: 28px;
    width: 100%;
    max-width: 400px;
}

/* Login brand lockup: pictogram stacked above the wordmark. */
.login-brand {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    margin-bottom: 20px;
}

.login-box h1 {
    text-align: center;
    font-size: 36px;
    line-height: 1;
    color: var(--color-text);
    margin-bottom: 0;
}
.login-box h1 .bee { color: var(--honey-dark); }

.login-box .brand-sub {
    display: block;
    text-align: center;
    font-size: 11px;
    letter-spacing: 0.28em;
    text-transform: uppercase;
    color: var(--color-accent-700);
    margin-top: 4px;
}

/* Small pictogram beside a device name in a table cell. */
.name-cell { display: inline-flex; align-items: center; gap: 8px; }
.bee-mark { display: block; flex-shrink: 0; }

/* --- Checkbox ----------------------------------------------------------- */
.checkbox-label { display: flex; align-items: center; gap: 0.5rem; font-size: 14px; }
.checkbox-label input[type="checkbox"] { width: auto; min-height: 0; }

/* --- Filters ------------------------------------------------------------ */
.filter-panel { margin-bottom: 1rem; }
.filter-toggle { margin-bottom: 0.5rem; }
.filter-row { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.filter-row select,
.filter-row input {
    padding: 5px 8px; font-size: 13px; min-height: 32px;
    border: 1px solid var(--color-divider); border-radius: var(--radius-sm); width: auto;
}
.filter-row input { width: 140px; }

/* Segmented filter control (Alle / Verbindung / Firmware / Konto). */
.seg { display: inline-flex; overflow: hidden; border: 1px solid var(--color-divider); border-radius: var(--radius-md); }
.seg a, .seg button {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 7px 12px; font-size: 13px; cursor: pointer;
    background: transparent; border: 0; color: var(--color-text);
    font-family: var(--font-body);
}
.seg a + a, .seg button + button { border-left: 1px solid var(--color-divider); }
.seg .active { background: var(--color-accent); color: var(--color-bg); text-decoration: none; }
.seg a:not(.active):hover { background: color-mix(in srgb, var(--color-text) 7%, transparent); text-decoration: none; }

/* --- Pagination bar ----------------------------------------------------- */
.pagination-bar { display: flex; justify-content: space-between; align-items: center; margin-top: 0.75rem; font-size: 13px; }
.pagination-bar select { width: auto; padding: 3px 8px; font-size: 13px; min-height: 30px; }
.page-nav { display: flex; gap: 0.5rem; align-items: center; }
.page-nav button:disabled { opacity: 0.4; cursor: default; }

/* --- Sortable headers --------------------------------------------------- */
th.sortable { cursor: pointer; user-select: none; }
th.sortable:hover { background: color-mix(in srgb, var(--color-text) 6%, transparent); }
.sort-arrow { font-size: 0.7rem; margin-left: 4px; opacity: 0.6; }

/* --- Language switcher -------------------------------------------------- */
.lang-switcher { margin-bottom: 0.5rem; }
.lang-switcher-login { text-align: right; margin-bottom: 1rem; }

.lang-select {
    appearance: auto;
    background: transparent;
    color: var(--color-accent-200);
    border: 1px solid color-mix(in srgb, var(--color-accent-100) 30%, transparent);
    border-radius: var(--radius-sm);
    padding: 2px 8px;
    font-size: 11px;
    letter-spacing: 0.08em;
    font-family: inherit;
    cursor: pointer;
    width: auto;
    min-height: 0;
}
.lang-select:focus { outline: none; border-color: var(--color-accent-300); box-shadow: none; }

.lang-select-login {
    background: var(--color-surface);
    color: var(--color-text);
    border-color: var(--color-divider);
}
.lang-select-login:focus { border-color: var(--color-accent); box-shadow: none; }

/* --- Health panel ------------------------------------------------------- */
.health-section {
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-md);
    padding: 20px;
}

.health-section h3 {
    font-family: var(--font-body);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 1rem;
    color: color-mix(in srgb, var(--color-text) 60%, transparent);
    font-weight: 500;
}

.health-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 14px; }

.health-card {
    background: var(--color-panel);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-md);
    padding: 14px 16px;
}

.health-card .label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--color-accent-700);
    letter-spacing: 0.1em;
    margin-bottom: 6px;
}

.health-card .health-value {
    font-family: var(--font-heading);
    font-size: 24px;
    font-weight: 600;
    margin-bottom: 6px;
}

.health-bar {
    height: 5px;
    background: var(--color-neutral-300);
    border-radius: 3px;
    overflow: hidden;
    margin-bottom: 6px;
}
.health-bar-fill { height: 100%; border-radius: 3px; transition: width 0.6s ease; }
.health-bar-fill.bar-green  { background: var(--green); }
.health-bar-fill.bar-yellow { background: var(--yellow); }
.health-bar-fill.bar-red    { background: var(--red); }

.health-detail { font-size: 11px; color: var(--color-neutral-600); }

/* --- Map ---------------------------------------------------------------- */
.map-section { margin-bottom: 0; }

.map-section h3 {
    font-family: var(--font-body);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin-bottom: 0.75rem;
    color: color-mix(in srgb, var(--color-text) 60%, transparent);
    font-weight: 500;
}

#deviceMap {
    height: 360px;
    border-radius: 0;
    border: 1px solid var(--color-divider);
    z-index: 0;
}

.map-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 200px;
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: 0;
    color: var(--color-neutral-600);
    font-size: 14px;
}

/* --- Turnstile ---------------------------------------------------------- */
.cf-turnstile { margin-bottom: 1rem; }

/* --- Register link ------------------------------------------------------ */
.register-link { text-align: center; margin-top: 1rem; font-size: 14px; color: var(--color-neutral-600); }

/* --- API key reveal ----------------------------------------------------- */
.api-key-reveal {
    font-family: var(--font-mono);
    background: var(--color-surface);
    border: 1px solid var(--color-divider);
    border-radius: var(--radius-md);
    padding: 10px 13px;
    font-size: 13px;
    word-break: break-all;
    user-select: all;
}

/* --- Cookie bar --------------------------------------------------------- */
.cookie-bar {
    position: fixed;
    bottom: 0; left: 0; right: 0;
    background: var(--color-accent-900);
    color: var(--color-accent-200);
    padding: 14px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    font-size: 13px;
    z-index: 9999;
}
.cookie-bar a { color: var(--honey-light); }
.cookie-buttons { display: flex; gap: 0.5rem; flex-shrink: 0; }

/* --- Utilities ---------------------------------------------------------- */
.mb-1 { margin-bottom: 1rem; }
.mt-1 { margin-top: 1rem; }
.text-muted { color: color-mix(in srgb, var(--color-text) 55%, transparent); }
.text-sm { font-size: 14px; }

/* Page header row: kicker + title on the left, actions on the right. */
.page-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
    flex-wrap: wrap;
}

/* --- Responsive --------------------------------------------------------- */
@media (max-width: 900px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; }
    .sidebar nav { flex-direction: row; flex-wrap: wrap; }
    .sidebar nav a { border-left: 0; border-bottom: 2px solid transparent; }
    .sidebar nav a.active { border-left: 0; border-bottom-color: var(--honey); }
    .main { padding: 18px; }
    .main h2 { font-size: 27px; }
    .hexrow { flex-wrap: wrap; row-gap: 8px; }
}

/* Wide content must scroll inside its own container, never the page body. */
.table-scroll { overflow-x: auto; }
