/* ============================================================
   CSS CUSTOM PROPERTIES (Design Tokens)
   ============================================================ */
:root {
    --color-primary:       #3498db;
    --color-primary-dark:  #2980b9;
    --color-nav-bg:        #2c3e50;
    --color-nav-dark:      #142638;
    --color-nav-hover:     #38495c;
    --color-text-muted:    #7f8c8d;
    --color-text-dark:     #2c3e50;
    --color-border:        #d1d5db;
    --color-border-light:  #e0e0e0;
    --color-secondary:     #95a5a6;
    --color-secondary-dark:#7f8c8d;
    --color-danger:        #dc2626;
    --color-bg-page:       floralwhite;
    --color-bg-card:       white;
    --color-bg-subtle:     #f9fafb;
    --color-bg-info:       #f0f9ff;
    --color-border-info:   #bfdbfe;
    --color-focus:         #3b82f6;
    --color-focus-shadow:  rgba(59, 130, 246, 0.1);
    --sidebar-width:       250px;
    --radius-sm:           4px;
    --radius-md:           8px;
    --shadow-card:         0 2px 8px rgba(0,0,0,0.1);
    --shadow-nav:          2px 0 5px rgba(0,0,0,0.1);
}

/* ============================================================
   RESET & BASE
   ============================================================ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto,
                 Oxygen, Ubuntu, Cantarell, sans-serif;
    display: flex;
    height: 100vh;
    background-color: var(--color-bg-page);
}

/* ============================================================
   LAYOUT — Sidebar & Main
   ============================================================ */
.sidebar {
    position: fixed;
    width: var(--sidebar-width);
    height: 100vh;
    background-color: var(--color-nav-bg);
    color: floralwhite;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-nav);
}

.sidebar-header {
    padding: 20px;
    background-color: var(--color-nav-dark);
    border-bottom: 1px solid dimgray;
}

.sidebar-header h1 {
    font-size: 20px;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 20px 0;
}

.main-content {
    margin-left: var(--sidebar-width);
    flex: 1;
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ============================================================
   TOP BARS  (top-bar is the title bar; top-bar-2 is breadcrumb/actions row)
   ============================================================ */

/* Shared base for all fixed top bars */
.top-bar,
.top-bar-2,
.top-nav {
    position: fixed;
    left: var(--sidebar-width);
    right: 0;
    z-index: 100;
}

.top-nav {
    /* also covers the legacy .top-nav-nav padding variant */
    background-color: var(--color-nav-bg);
    color: floralwhite;
    display: flex;
    flex-direction: row;
    box-shadow: var(--shadow-nav);
}

.top-nav-nav {
    padding: 0 20px;
    display: flex;
    flex-direction: row;
}

.top-bar {
    top: 0;
    background-color: white;
    padding: 20px;
    border-bottom: 1px solid var(--color-border-light);
    box-shadow: 0 2px 4px rgba(0,0,0,0.05);
}

.top-bar h2 {
    font-size: 20px;
    color: var(--color-text-dark);
}

.top-bar-2 {
    background-color: inherit;
    padding: 10px;
    display: flex;
    flex-direction: row;
    flex-wrap: wrap;
    z-index: 99;
    border-bottom: 1px solid var(--color-border-light);
}

/* ============================================================
   BREADCRUMBS
   ============================================================ */
.breadcrumbs {
    flex-basis: 50%;
    display: flex;
    flex-direction: row;
    padding: 5px;
}

.breadcrumbs a {
    text-decoration: none;
    padding: 0 5px;
    color: inherit;
}

.breadcrumbs a:hover { text-decoration: underline; }

/* ============================================================
   NAV ITEMS
   ============================================================ */
.nav-item {
    padding: 15px 20px;
    cursor: pointer;
    transition: background-color 0.2s;
    color: floralwhite;
    text-decoration: none;
    display: block;
}

.nav-item:hover { background-color: var(--color-nav-hover); }

.nav-item.disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.nav-item.disabled:hover { background-color: transparent; }

.nav-item--active {
    background-color: var(--color-nav-hover);
    font-weight: 600;
}

/* Taller variant used in the top nav */
.nav-item.top { padding: 23px 15px; }

/* ============================================================
   BUTTONS  — unified .btn system
   ============================================================

   Replaces: .action-btn, .actions-dropbtn, .dropdown-item, .toolbar-btn

   Usage:
     <button class="btn">Primary</button>
     <button class="btn btn--secondary">Secondary / muted</button>
     <button class="btn btn--danger">Danger</button>
     <button class="btn btn--sm">Small</button>
     <a    class="btn">Link styled as button</a>

   Border-radius join helpers (unchanged names kept):
     .left-integrate  .middle-integrate  .right-integrate
*/
.btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 12px 24px;
    background-color: var(--color-primary);
    color: white;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    transition: background-color 0.2s;
    white-space: nowrap;
}

.btn:hover { background-color: var(--color-primary-dark); }

.btn--secondary,
.btn--search,
.btn--submit {
    background-color: var(--color-secondary);
}
.btn--secondary:hover,
.btn--search:hover,
.btn--submit:hover {
    background-color: var(--color-secondary-dark);
}

.btn--danger { background-color: var(--color-danger); }

/* Small variant — used in toolbar & doc-section controls */
.btn--sm {
    padding: 4px 8px;
    font-size: 12px;
    border-radius: var(--radius-sm);
    border-color: var(--color-border);
    background-color: white;
    color: inherit;
}
.btn--sm:hover { background-color: #f3f4f6; }
.btn--sm.active {
    background-color: #dbeafe;
    border-color: var(--color-focus);
}

/* Icon-only round button (gallery remove) */
.btn--icon {
    padding: 0;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    font-size: 12px;
    justify-content: center;
}

/* Border-radius join helpers */
.left-integrate   { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.middle-integrate { border-radius: 0; }
.right-integrate  { border-top-left-radius: 0; border-bottom-left-radius: 0; }

/* ============================================================
   ACTIONS DROPDOWN  (top-bar area)
   ============================================================ */
.actions {
    margin-left: auto;
    max-width: fit-content;
    position: relative;
    display: flex;
}

.actions-dropdown,
.actions-forms {
    position: absolute;
    top: 110%;
    right: 0;
    box-shadow: 0 8px 16px rgba(0,0,0,0.2);
    z-index: 1;
    flex-direction: column;
}

.actions-dropdown { display: none; }

/* Dropdown items are .btn with join helpers */
.dropdown-item {
    /* kept for backward compat; new markup can use .btn instead */
    text-align: left;
    background-color: var(--color-primary);
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: var(--radius-sm);
    display: block;
    cursor: pointer;
}
.dropdown-item:hover { background-color: var(--color-primary-dark); }
.dropdown-item.top-integrate    { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.dropdown-item.bottom-integrate { border-top-left-radius: 0;    border-top-right-radius: 0; }
.dropdown-item.hidden-form      { cursor: default; padding: 0; display: none; max-width: 1000px; }

/* ============================================================
   FORMS & INPUTS  — unified .field system
   ============================================================

   Replaces: .search-input, .company-input, .hidden-form-input,
             .editable-input, .editable-textarea

   Usage:
     <input  class="field">               standard text input
     <input  class="field field--joined"> left-joined (was search-input / company-input)
     <input  class="field field--rounded">standalone rounded (was .company-input.edit)
     <textarea class="field field--area"> textarea (was editable-textarea)
     <input  class="field field--title">  large title input (was title-editor)
*/
.field {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid var(--color-border);
    border-top-left-radius: var(--radius-md);
    border-bottom-left-radius: var(--radius-md);
    font-size: 14px;
    font-family: inherit;
    outline: none;
    transition: border-color 0.2s;
    background: white;
}

.field:focus {
    border-color: var(--color-focus);
    box-shadow: 0 0 0 3px var(--color-focus-shadow);
}

/* Standalone (not joined to a button) */
.field--rounded {
    border-radius: var(--radius-md);
}

/* Textarea */
.field--area {
    border-radius: var(--radius-sm);
    min-height: 80px;
    resize: vertical;
}

/* Large title input */
.field--title {
    width: 100%;
    font-size: 28px;
    font-weight: bold;
    border-radius: var(--radius-sm);
    margin-bottom: 12px;
    padding: 8px;
}

/* Small editable cell input */
.field--cell {
    width: 100%;
    padding: 8px;
    border-radius: var(--radius-sm);
}

/* ============================================================
   FORMS (layout wrappers)
   ============================================================ */
.form-row {
    /* Replaces: .search-form, .company-form */
    display: flex;
    max-width: 1000px;
}

.form-col {
    /* Replaces: .company-form.edit */
    display: flex;
    flex-direction: column;
}

.form-col label { display: block; }

.button-area {
    display: flex;
    flex-direction: row-reverse;
    padding: 10px;
}

/* ============================================================
   CARDS
   ============================================================ */
.card {
    background: var(--color-bg-card);
    padding: 40px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
    max-width: 800px;
}

.card h3 {
    font-size: 28px;
    color: var(--color-text-dark);
    margin-bottom: 15px;
}

.card p {
    font-size: 16px;
    color: var(--color-text-muted);
    line-height: 1.6;
}

.quick-actions {
    margin-top: 30px;
    display: flex;
    gap: 15px;
}

/* ============================================================
   CONTENT AREA
   ============================================================ */
.content-area {
    flex: 1;
    padding: 20px;
    overflow-y: auto;
}

/* ============================================================
   DATA TABLES  — unified .data-table
   ============================================================

   Replaces: .company-list, .address-list (they were identical)
*/
.data-table {
    width: 100%;
    background: var(--color-bg-card);
    padding: 5px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.data-table tr  { height: 20px; }

.data-table th,
.data-table td  {
    text-align: left;
    border-bottom: 1px solid var(--color-border-light);
    padding: 5px;
}

.data-table .col-main  { width: 33%; }
.data-table .col-small { width: auto; }

.data-table a {
    text-decoration: none;
    color: inherit;
}
.data-table a:hover {
    text-decoration: underline;
    cursor: pointer;
}

/* ============================================================
   FOLDER / DOCUMENT LIST  — unified .item-list
   ============================================================

   Replaces: .folder-list, .folder-item, .document-item (were identical)
*/
.item-list {
    display: flex;
    flex-direction: column;
    background: var(--color-bg-card);
    padding: 5px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.list-header {
    display: flex;
    align-items: center;
    padding: 4px 5px;
    border-bottom: 1px solid var(--color-border);
    font-size: 0.8em;
    font-weight: 600;
    color: var(--color-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.list-header-name {
    cursor: pointer;
    user-select: none;
    display: flex;
    align-items: center;
    gap: 4px;
}
.list-header-name:hover { color: var(--color-text-dark); }
.list-header-name::after          { content: "↕"; font-size: 0.9em; color: var(--color-text-muted); }
.list-header-name.sort-asc::after  { content: "↑"; color: var(--color-text-dark); }
.list-header-name.sort-desc::after { content: "↓"; color: var(--color-text-dark); }

.list-item { padding: 5px; }

.list-item a {
    text-decoration: none;
    padding: 5px;
    color: inherit;
}
.list-item a:hover { text-decoration: underline; }

/* ============================================================
   DOCUMENT VIEW
   ============================================================ */
.doc-main-container {
    max-width: 900px;
    background: var(--color-bg-card);
    padding: 24px;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card);
}

.doc-title {
    font-size: 28px;
    margin-left: 10px;
    margin-bottom: 12px;
}

.doc-section-container { display: flex; flex-direction: column; }

.doc-section {
    line-height: 1.5;
    color: black;
    margin-left: 10px;
}

/* Content variants — replaces .doc-section-content + modifier classes */
.doc-content {
    font-size: 14px;
    margin-top: 10px;
}
.doc-content--heading { font-size: 18px; }
.doc-content--steps   { margin-left: 20px; }
.doc-content--gallery img {
    max-width: 200px;
    margin: 6px;
    border-radius: 6px;
    border: 1px solid #e6eef6;
}

/* Section editor */
.doc-section-editor {
    border: 1px solid #e5e7eb;
    border-radius: 6px;
    padding: 16px;
    margin-bottom: 16px;
    background: var(--color-bg-subtle);
}
.doc-section-editor.editing { border-color: var(--color-focus); }

.doc-section-controls {
    display: flex;
    gap: 8px;
    margin-bottom: 12px;
}

/* ============================================================
   STEP LIST
   ============================================================ */
.step-list { list-style: none; padding: 0; margin: 0; }

.step-item {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
    align-items: center;
}
.step-item input { flex: 1; }

/* ============================================================
   GALLERY EDITOR
   ============================================================ */
.gallery-editor { display: flex; flex-wrap: wrap; gap: 8px; }

.gallery-item { position: relative; display: inline-block; }
.gallery-item img { max-width: 150px; border-radius: var(--radius-sm); }

/* Remove button — use .btn.btn--icon.btn--danger in HTML */
.gallery-item button {
    position: absolute;
    top: 4px;
    right: 4px;
    background: var(--color-danger);
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 24px;
    height: 24px;
    cursor: pointer;
    font-size: 12px;
}

/* ============================================================
   RICH TEXT EDITOR & TOOLBAR
   ============================================================ */
.text-toolbar {
    display: flex;
    gap: 4px;
    margin-bottom: 8px;
    padding: 8px;
    background: white;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}

/* Toolbar buttons → use .btn.btn--sm in new markup */
.toolbar-btn {
    padding: 6px 10px;
    border: 1px solid var(--color-border);
    background: white;
    border-radius: var(--radius-sm);
    cursor: pointer;
    font-size: 13px;
    display: flex;
    align-items: center;
    gap: 4px;
}
.toolbar-btn:hover  { background: #f3f4f6; }
.toolbar-btn.active { background: #dbeafe; border-color: var(--color-focus); }

.toolbar-separator { width: 1px; background: var(--color-border); margin: 0 4px; }

.rich-text-editor {
    min-height: 120px;
    padding: 12px;
    border: 1px solid var(--color-border);
    border-radius: var(--radius-sm);
    background: white;
    outline: none;
    font-family: inherit;
    font-size: inherit;
    line-height: 1.6;
}
.rich-text-editor:focus { border-color: var(--color-focus); }
.rich-text-editor a  { color: #2563eb; text-decoration: underline; }
.rich-text-editor strong { font-weight: bold; }
.rich-text-editor em     { font-style: italic; }
.rich-text-editor u      { text-decoration: underline; }
.rich-text-editor s      { text-decoration: line-through; }

/* ============================================================
   ADD SECTIONS PANEL
   ============================================================ */
.add-sections {
    margin-top: 20px;
    padding: 16px;
    background: var(--color-bg-info);
    border-radius: 6px;
    border: 1px solid var(--color-border-info);
}
.add-sections h3 {
    margin-top: 0;
    font-size: 16px;
    color: #1e40af;
}

/* ============================================================
   UTILITIES
   ============================================================ */
.hidden  { display: none; }

.inline-img { height: 20px; width: 20px; }

#map { height: 360px; }

/* ============================================================
   TABLE TOOLBAR  — search box + filter dropdown inside top-bar-2
   ============================================================ */

/* Flex container that takes up the available space left of the .actions button */
.table-toolbar {
    display: flex;
    gap: 8px;
    align-items: center;
    padding: 4px;
    flex: 1;       /* Pushes the .actions button to the far right */
    min-width: 0;  /* Allows children to shrink on narrow viewports */
}

/* Constrain all toolbar controls so they don't stretch to fill the bar.
   The search box gets a bit more space; dropdowns are narrower. */
.table-toolbar .field {
    flex: 0 0 auto;
    max-width: 160px;
}

/* Give the search input more room since users type longer queries */
.table-toolbar #deviceSearch {
    max-width: 200px;
}

/* ============================================================
   SORTABLE COLUMN HEADERS  — used in the Configurations table
   ============================================================ */

/* Pointer cursor and no text selection when clicking to sort */
.data-table th[data-sort] {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

/* Subtle highlight so users can see the header is interactive */
.data-table th[data-sort]:hover { background-color: var(--color-bg-subtle); }

/* Default "unsorted" indicator appended after each sortable header's text */
.data-table th[data-sort]::after          { content: " ↕"; color: var(--color-text-muted); font-size: 0.75em; }
/* Active sort direction indicators */
.data-table th.sort-asc[data-sort]::after  { content: " ↑"; color: var(--color-text-dark); font-size: 0.75em; }
.data-table th.sort-desc[data-sort]::after { content: " ↓"; color: var(--color-text-dark); font-size: 0.75em; }

/* Online/offline status indicator dot (used in Configurations device list and detail) */
.status-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 5px;
    vertical-align: middle;
}
.status-dot--online  { background-color: #16a34a; }
.status-dot--offline { background-color: #9ca3af; }

/* Preformatted code block for displaying environment variable names, etc. */
.code-block {
    background: #f1f5f9;
    border: 1px solid #e2e8f0;
    border-radius: var(--radius-md);
    padding: 12px 16px;
    font-size: 0.85em;
    line-height: 1.7;
    overflow-x: auto;
}

/* Flex row / col helpers (used in various layouts) */
div.row {
    display: flex;
    flex-direction: row;
    margin-bottom: 10px;
}
div.col {
    display: flex;
    flex-direction: column;
    margin-right: 10px;
}

/* ============================================================
   SIDEBAR FOOTER  — admin link pinned to the bottom of the sidebar
   ============================================================ */

/* The sidebar uses display:flex + flex-direction:column.
   sidebar-nav has flex:1, so it expands to fill all available space,
   which naturally pushes sidebar-footer to the very bottom. */
.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    padding: 8px 0;
}

/* Allow nav content to scroll if it exceeds the sidebar height,
   so the footer is never pushed off screen by overflow */
.sidebar-nav {
    overflow-y: auto;
}

/* Gear icon sits to the left of the label text */
.nav-item--admin {
    display: flex;
    align-items: center;
    gap: 8px;
}

.nav-item--admin__icon {
    font-size: 1.1em;
    line-height: 1;
}

/* ============================================================
   INTEGRATION CARDS  — overview grid on Admin > Integrations
   ============================================================ */

/* Responsive grid that wraps at narrower widths */
.integration-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
    gap: 20px;
}

/* Card header: name + badge on the left, action button on the right */
.integration-card__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
}

.integration-card__title {
    display: flex;
    align-items: center;
    gap: 10px;
}

.integration-card__name {
    font-size: 1.05em;
    font-weight: 600;
    color: var(--color-text-dark);
}

.integration-card__description {
    color: var(--color-text-muted);
    font-size: 0.9em;
    line-height: 1.5;
    margin-bottom: 12px;
}

.integration-card__stats {
    font-size: 0.85em;
    color: var(--color-text-muted);
}

/* ============================================================
   STATUS BADGES  — used on integration cards and wherever a
   concise status pill is needed
   ============================================================ */
.badge {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 12px;
    font-size: 0.75em;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    white-space: nowrap;
}

.badge--active         { background-color: #dcfce7; color: #166534; }
.badge--disabled       { background-color: #f3f4f6; color: #6b7280; }
.badge--not-configured { background-color: #fef9c3; color: #854d0e; }

/* ============================================================
   MISC ADMIN UI HELPERS
   ============================================================ */

/* Inline form: dropdown + button side by side in a table cell */
.inline-form {
    display: flex;
    align-items: center;
    gap: 6px;
}

/* Compact field variant for tight table cells */
.field--compact {
    padding: 4px 8px;
    font-size: 0.9em;
    max-width: 220px;
}

/* Small hint text shown beneath a form field */
.field-hint {
    display: block;
    margin-top: 4px;
    font-size: 0.8em;
    color: var(--color-text-muted);
}

/* Checkbox + label on the same line */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    user-select: none;
}

/* Muted text helper (mirrors Bootstrap's text-muted) */
.text-muted { color: var(--color-text-muted); }

/* Danger button variant — used for destructive actions like "Unlink" */
.btn--danger {
    background-color: var(--color-danger);
    color: white;
}
.btn--danger:hover { background-color: #b91c1c; }

/* Integrations pages */
.integrations-top-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.integration-card {
    max-width: none;
    padding: 24px;
}

.integration-form-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-top: 12px;
}

/* ============================================================
   LOGIN PAGE
   ============================================================ */
.login-body {
    justify-content: center;
    align-items: center;
    background-color: var(--color-nav-bg);
}

.login-container {
    width: 100%;
    max-width: 420px;
    padding: 24px;
}

.login-card {
    max-width: none;
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}

.login-logo h1 {
    font-size: 32px;
    font-weight: 700;
    color: var(--color-text-dark);
    margin-bottom: 4px;
}

.login-tagline {
    font-size: 14px;
    color: var(--color-text-muted);
    margin: 0;
}

/* ============================================================
   TOP NAV USER INFO
   ============================================================ */
.top-nav-user {
    margin-left: auto;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 0 16px;
    font-size: 13px;
    color: rgba(255,255,255,0.75);
}

.top-nav-user a {
    color: rgba(255,255,255,0.75);
    text-decoration: none;
    padding: 4px 8px;
    border-radius: var(--radius-sm);
    transition: background-color 0.15s, color 0.15s;
}

.top-nav-user a:hover {
    background-color: var(--color-nav-hover);
    color: white;
}

.top-nav-user .user-separator {
    opacity: 0.4;
}

/* Default-password warning banner */
.default-password-warning {
    background-color: #fef3c7;
    border-bottom: 1px solid #fcd34d;
    padding: 8px 20px;
    font-size: 13px;
    color: #92400e;
    position: fixed;
    left: var(--sidebar-width);
    right: 0;
    z-index: 110;
}

.default-password-warning a {
    color: #92400e;
    font-weight: 600;
}

/* ============================================================
   SETTINGS PAGE  — card with internal tabs
   ============================================================ */

/* Full-width card override for the settings page */
.settings-card {
    max-width: none;
    padding: 0;
}

/* Tab strip sits flush against the top of the card */
.settings-tabs {
    display: flex;
    flex-direction: row;
    border-bottom: 1px solid var(--color-border-light);
    padding: 0 24px;
    gap: 0;
}

.settings-tab {
    padding: 14px 20px;
    font-size: 14px;
    font-weight: 500;
    font-family: inherit;
    color: var(--color-text-muted);
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
    margin-bottom: -1px; /* overlap the card border-bottom */
    white-space: nowrap;
}

.settings-tab:hover {
    color: var(--color-text-dark);
}

.settings-tab--active {
    color: var(--color-primary);
    border-bottom-color: var(--color-primary);
    font-weight: 600;
}

/* Panel content area */
.settings-panel {
    padding: 28px 24px;
}

.settings-section-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--color-text-dark);
    margin-bottom: 4px;
}

.settings-section-desc {
    font-size: 14px;
    color: var(--color-text-muted);
    margin-bottom: 24px;
}

/* Stack of labelled fields */
.settings-fields {
    display: flex;
    flex-direction: column;
    gap: 20px;
    max-width: 560px;
}

.settings-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.settings-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--color-text-dark);
}

/* Select element styled to match .field */
.field--select {
    border-radius: var(--radius-md);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%237f8c8d' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 32px;
}

/* Radio group vertical stack */
.settings-radio-group {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

/* Actions row at the bottom of each panel */
.settings-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-top: 28px;
    padding-top: 20px;
    border-top: 1px solid var(--color-border-light);
}

.admin-alert {
    padding: 10px 12px;
    border-radius: var(--radius-md);
    margin-bottom: 16px;
    border: 1px solid transparent;
}

.admin-alert--error {
    background-color: #fef2f2;
    border-color: #fecaca;
    color: #991b1b;
}

.admin-alert--success {
    background-color: #ecfdf5;
    border-color: #86efac;
    color: #166534;
}
