/* Cliora 5.0.5 — the last sheet in the chain.
   Three jobs: navigating Settings, bringing the media library onto the same
   card as the other library pages, and the phone layout.
   The library card itself is defined in ui-2.css and team-ui.css; this sheet
   follows it rather than restating it. Never styles stored canvas contents. */

/* ========================================================================
   1. Settings: pick an area, then a section inside it.
   ======================================================================== */

.cliora-app .ui-settings-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    display: grid;
    gap: 10px;
    padding: 10px 0 14px;
    margin: 0;
    background: var(--bg-app);
}
/* The cards scroll under the bar, so it needs an edge of its own. */
.cliora-app .ui-settings-nav::after {
    content: '';
    position: absolute;
    left: 0; right: 0; bottom: 0;
    height: 14px;
    background: linear-gradient(var(--bg-app), transparent);
    pointer-events: none;
}

.cliora-app .ui-settings-areas {
    display: flex;
    gap: 4px;
    padding: 4px;
    border: 1px solid var(--border-color);
    border-radius: 14px;
    background: var(--bg-panel);
    overflow-x: auto;
    scrollbar-width: none;
}
.cliora-app .ui-settings-areas::-webkit-scrollbar { display: none; }
.cliora-app .ui-settings-areas button {
    flex: 1 1 auto;
    min-height: 38px;
    padding: 8px 15px;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--text-muted);
    font: inherit;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.25;
    white-space: nowrap;
    cursor: pointer;
}
.cliora-app .ui-settings-areas button:hover { color: var(--text-main); background: var(--ui-hover); }
.cliora-app .ui-settings-areas button[aria-selected="true"] {
    background: var(--ui-soft);
    color: var(--ui-accent);
    font-weight: 600;
}

.cliora-app .ui-settings-sections { display: flex; gap: 6px; flex-wrap: wrap; padding: 0; }
.cliora-app .ui-settings-sections[hidden] { display: none; }
.cliora-app .ui-settings-sections button {
    min-height: 34px;
    padding: 7px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-panel);
    color: var(--text-muted);
    font: inherit;
    font-size: 12px;
    line-height: 1.3;
    cursor: pointer;
}
.cliora-app .ui-settings-sections button:hover { color: var(--ui-accent); border-color: var(--ui-accent); }
.cliora-app .ui-settings-sections button[aria-pressed="true"] {
    background: var(--ui-soft);
    border-color: var(--ui-accent);
    color: var(--ui-accent);
    font-weight: 600;
}
@media (hover: none) {
    .cliora-app .ui-settings-areas button:hover { color: var(--text-muted); background: transparent; }
    .cliora-app .ui-settings-areas button[aria-selected="true"]:hover { background: var(--ui-soft); color: var(--ui-accent); }
    .cliora-app .ui-settings-sections button:hover { color: var(--text-muted); border-color: var(--border-color); }
    .cliora-app .ui-settings-sections button[aria-pressed="true"]:hover { color: var(--ui-accent); border-color: var(--ui-accent); }
}

/* ------------------------------------------------------------------------
   1b. One card shape, whoever builds it.
   The HTML cards carry a .settings-section-title; the ones assembled in
   JavaScript are a bare h2 followed by a paragraph. Both read the same here.
   ------------------------------------------------------------------------ */

.cliora-app .settings-card > h2,
.cliora-app .team-account-section > h2 {
    margin: 0 0 6px;
    font-size: 18px;
    font-weight: 500;
    letter-spacing: -.35px;
    line-height: 1.35;
}
.cliora-app .settings-card > h2 + p,
.cliora-app .team-account-section > h2 + p {
    margin: 0 0 18px;
    max-width: 78ch;
    font-size: 13px;
    line-height: 1.75;
    color: var(--text-muted);
}
/* A bare h3 inside a card opens a block of its own, like .settings-sub does. */
.cliora-app .settings-card > h3 {
    margin: 26px 0 8px;
    padding-top: 22px;
    border-top: 1px solid var(--border-color);
    font-size: 14.5px;
    font-weight: 600;
    letter-spacing: -.2px;
}
.cliora-app .settings-card > p,
.cliora-app .team-account-section > p { max-width: 78ch; }

/* A field is a label above a control, never a control stretched across the
   whole card. Numbers and short codes get a width that matches their content. */
.cliora-app .settings-card > .settings-field,
.cliora-app .settings-card > label.settings-field,
.cliora-app .settings-card .settings-sub > label.settings-field,
.cliora-app .settings-card .settings-sub > .settings-field { max-width: 560px; margin: 0 0 14px; }
.cliora-app .settings-card .settings-field input[type="number"] { max-width: 180px; }

/* team-ui and the admin panels build fields as label.settings-field with the
   control inside; the HTML cards nest an explicit <label> instead. */
.cliora-app .settings-card label.settings-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    font-size: 12px;
    color: var(--text-muted);
    min-width: 0;
}
.cliora-app .settings-card label.settings-field > input[type="file"] { padding: 9px; font-size: 12px; }

/* A checkbox with a sentence beside it is a row, not a stacked field. */
.cliora-app .settings-card label.settings-help {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    max-width: 78ch;
    margin: 12px 0;
    cursor: pointer;
}
.cliora-app .settings-card label.settings-help input[type="checkbox"] {
    width: 18px;
    min-width: 18px;
    height: 18px;
    margin-top: 2px;
    accent-color: var(--accent-blue);
}

/* Buttons in a card all carry the same weight and height. */
.cliora-app .settings-card :is(.settings-btn, .btn-action, .btn-primary) {
    min-height: 40px;
    padding: 9px 16px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
}
.cliora-app .settings-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 16px 0; }
.cliora-app .settings-card > button { margin: 6px 0 16px; }

/* Status lines sit under the control they answer for, not against the edge. */
.cliora-app .settings-status { max-width: 78ch; overflow-wrap: anywhere; }

/* The grid that groups related inputs never squeezes below a readable width. */
.cliora-app .settings-card .provider-grid {
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
    gap: 14px;
    margin-bottom: 16px;
}

/* ========================================================================
   2. The media library joins the other library pages.
   Contents, ArtWall, Devices and Links already share one card. Assets drew
   its own; these rules give it the same shape, in both views.
   ======================================================================== */

.cliora-app .file-grid { grid-template-columns: repeat(auto-fill, minmax(235px, 1fr)); gap: 18px; }
.cliora-app .file-grid > .file-card {
    display: flex;
    flex-direction: column;
    min-height: 220px;
    padding: 0;
    border: 1px solid var(--border-color);
    border-radius: 15px;
    background: var(--bg-panel);
    overflow: hidden;
    box-shadow: 0 2px 2px #00000005;
    transition: border-color .18s, box-shadow .18s;
}
.cliora-app .file-grid > .file-card:hover { border-color: #807788; transform: none; box-shadow: var(--ui-shadow); }
.cliora-app .file-grid .file-preview {
    height: 120px;
    margin: 0;
    background: var(--ui-input);
    border: 0;
    border-radius: 0;
    color: var(--text-muted);
}
.cliora-app .file-grid .file-preview i { font-size: 38px; }
.cliora-app .file-grid .folder-card .file-preview i { font-size: 44px; }
.cliora-app .file-grid .file-info { flex: 1; display: flex; flex-direction: column; gap: 0; padding: 0; }
.cliora-app .file-grid .file-name {
    margin: 12px 12px 8px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.4;
    letter-spacing: -.15px;
}
.cliora-app .file-grid .file-meta {
    padding: 0 12px;
    gap: 6px;
    font-size: 10px;
    justify-content: space-between;
    align-items: center;
}
.cliora-app .file-grid .file-actions-menu { margin: auto 0 0; padding: 12px; gap: 8px; }
.cliora-app .file-grid .f-btn {
    flex: 1 1 auto;
    min-height: 30px;
    padding: 6px 10px;
    border-radius: 8px;
    background: var(--bg-app);
    font-size: 12px;
}
.cliora-app .file-grid .f-btn:hover { background: var(--ui-soft); border-color: var(--ui-accent); color: var(--ui-accent); }
.cliora-app .file-grid .f-btn.danger:hover { background: transparent; border-color: var(--ui-danger); color: var(--ui-danger); }

/* ------------------------------------------------------------------------
   2b. Page furniture: the same toolbar, filters and empty state everywhere.
   ------------------------------------------------------------------------ */

.cliora-app .filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.cliora-app .filter-btn {
    min-height: 38px;
    padding: 8px 14px;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    background: var(--bg-panel);
    color: var(--text-muted);
    font-size: 12.5px;
    font-weight: 500;
}
.cliora-app .filter-btn:hover { background: var(--ui-hover); color: var(--text-main); }
.cliora-app .filter-btn.active { background: var(--ui-soft); border-color: var(--ui-accent); color: var(--ui-accent); font-weight: 600; }
@media (hover: none) {
    .cliora-app .filter-btn:hover { background: var(--bg-panel); color: var(--text-muted); }
    .cliora-app .filter-btn.active:hover { background: var(--ui-soft); color: var(--ui-accent); }
}

.cliora-app .settings-empty,
.cliora-app .library-empty {
    grid-column: 1 / -1;
    padding: 44px 22px;
    border: 1px dashed var(--border-color);
    border-radius: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13.5px;
}

/* ------------------------------------------------------------------------
   2c. Paging. A list pages in hundreds; a wall of tiles grows fifty at a time,
   because scrolling back to a control you have already passed is a chore.
   ------------------------------------------------------------------------ */

.cliora-app .library-pager {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 14px;
    flex-wrap: wrap;
    margin: 22px 0 6px;
}
.cliora-app .library-pager .library-pager-count { color: var(--text-muted); font-size: 12.5px; }
.cliora-app .library-pager button { min-height: 40px; padding: 9px 16px; border-radius: 10px; font-size: 13px; }
.cliora-app button.library-load-more {
    display: block;
    width: min(100%, 320px);
    margin: 22px auto 6px;
    min-height: 44px;
    padding: 11px 18px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--bg-panel);
    color: var(--text-main);
    font: inherit;
    font-size: 13.5px;
    font-weight: 600;
    cursor: pointer;
}
.cliora-app button.library-load-more:hover { border-color: var(--ui-accent); color: var(--ui-accent); }

/* ========================================================================
   3. The phone.
   ======================================================================== */

/* Nothing may make the page wider than the screen. A single overflowing row
   is what forces the whole interface to be pinched back into view. */
.cliora-app,
.cliora-auth { max-width: 100%; overflow-x: hidden; }
.cliora-app #app-container { min-width: 0; max-width: 100%; }
.cliora-app :is(.manager-body, .settings-body, .dashboard-wrapper, .docs-page, .toolbar, .manager-header) { min-width: 0; max-width: 100%; }
.cliora-app :is(.contents-container, .file-grid, .settings-wrap) { min-width: 0; }
.cliora-app :is(.settings-card, .team-account-section) pre { max-width: 100%; overflow-x: auto; }
.cliora-app table { max-width: 100%; }

@media (max-width: 767px) {
    /* A control a finger has to hit is at least 44px tall, and a label that
       cannot fit is shortened rather than clipped mid-word. */
    .cliora-app .manager-header .header-actions :is(.btn-primary, .btn-action),
    .cliora-app .manager-header .header-actions summary.btn-primary { min-height: 44px; font-size: 13px; }
    .cliora-app .toolbar .btn-action,
    .cliora-app .toolbar .filter-btn { min-height: 42px; }
    .cliora-app .filter-tabs { gap: 5px; }
    .cliora-app .filter-btn { padding: 8px 11px; font-size: 12px; }

    /* Two tiles across in the media library too, with the buttons on a row of
       their own so they stop being squeezed into slivers. */
    .cliora-app .file-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
    .cliora-app .file-grid .file-preview { height: 96px; }
    .cliora-app .file-grid .file-name { margin: 10px 10px 6px; font-size: 12px; }
    .cliora-app .file-grid .file-meta { padding: 0 10px; flex-wrap: wrap; }
    .cliora-app .file-grid .file-actions-menu { display: grid; grid-template-columns: repeat(auto-fit, minmax(40px, 1fr)); gap: 5px; padding: 10px; }
    .cliora-app .file-grid .f-btn { width: 100%; min-height: 40px; padding: 8px 4px; }

    /* Settings on a phone: the areas scroll sideways, the sections wrap. */
    .cliora-app .ui-settings-areas { border-radius: 12px; }
    .cliora-app .ui-settings-areas button { flex: 0 0 auto; padding: 9px 14px; min-height: 40px; }
    .cliora-app .ui-settings-sections button { min-height: 38px; font-size: 12.5px; }
    .cliora-app .settings-card :is(.settings-btn, .btn-action, .btn-primary) { min-height: 44px; }
    .cliora-app .settings-actions > button { flex: 1 1 180px; }
    .cliora-app .settings-card > button { width: 100%; }
    .cliora-app .settings-card .provider-grid { grid-template-columns: 1fr; }
    .cliora-app .settings-card > .settings-field,
    .cliora-app .settings-card > label.settings-field,
    .cliora-app .settings-card .settings-sub > label.settings-field,
    .cliora-app .settings-card .settings-sub > .settings-field { max-width: 100%; }
    .cliora-app .library-pager button,
    .cliora-app button.library-load-more { min-height: 46px; }

    /* On a phone the welcome panel is a screenful of reading before the first
       control. The section switcher comes first instead, so Settings opens on
       something you can act on. */
    .cliora-app .settings-wrap { display: flex; flex-direction: column; }
    .cliora-app .settings-wrap > #settings-notice { order: -2; }
    .cliora-app .settings-wrap > .ui-settings-nav { order: -1; margin-bottom: 4px; }
}

/* ------------------------------------------------------------------------
   4. The list view is a list: one row per item, one line of buttons.
   The overflow button used to be pushed to the far right with margin-left:auto,
   which in a wrapping row left it no space and dropped it onto a second line —
   doubling the height of every row on a hundred-row page.
   ------------------------------------------------------------------------ */

.cliora-app .contents-container.list-view .content-card { min-height: 58px; padding: 9px 16px; }
.cliora-app .contents-container.list-view .content-actions { flex-wrap: nowrap; gap: 6px; align-items: center; }
.cliora-app .contents-container.list-view .content-card .content-actions .library-more { margin-left: 0; }
.cliora-app .contents-container.list-view .content-actions :is(.btn-action, a.btn-action) {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    min-width: 34px;
    height: 34px;
    min-height: 34px;
    padding: 0;
    border-radius: 9px;
}
.cliora-app .contents-container.list-view .content-display-icon { width: 40px; height: 34px; }
.cliora-app .contents-container.list-view .content-icon { width: 40px; min-width: 40px; }

@media (max-width: 767px) {
    /* On a phone the row keeps its single line of buttons; the meta wraps under
       the name instead, which is what actually needs the space. The buttons
       used to be given the full width of their own third line, which made a
       hundred-row page three times as long as it needed to be. */
    .cliora-app .contents-container.list-view .content-card { min-height: 0; padding: 11px 13px; align-items: center; }
    .cliora-app .contents-container.list-view .content-card .content-actions {
        width: auto;
        flex: 0 0 auto;
        margin-left: 12px;
        justify-content: flex-end;
    }
    .cliora-app .contents-container.list-view .content-actions :is(.btn-action, a.btn-action) {
        width: 40px; min-width: 40px; height: 40px; min-height: 40px;
    }
    .cliora-app .contents-container.list-view .content-meta { font-size: 10.5px; gap: 3px 14px; }
}
