/* ==========================================================================
   NCDRV design system
   Loaded last by every layout. Defines the tokens, the application shell and
   the shared components. Existing page styles inherit the palette through the
   legacy token names (--primary, --gray-*) that are remapped below.
   ========================================================================== */

:root {
    /* Core palette, taken from the brand assets in public/assets/images:
       logo blue #1A73E8 and the wordmark's black (deepened to a blue-black ink). */
    --ink:          #0F1B2D;   /* sidebar, headings */
    --ink-2:        #18283F;
    --ink-3:        #243852;
    --canvas:       #F4F6F8;   /* page background */
    --panel:        #FFFFFF;
    --rule:         #DCE3EA;   /* 1px borders */
    --rule-strong:  #C3CDD8;
    --text:         #111A27;
    --text-2:       #4A5768;
    --text-3:       #738094;
    --accent:       #1A73E8;   /* brand blue (logo) */
    --accent-hover: #1558B8;
    --accent-soft:  #E8F1FD;
    --accent-line:  #7AB0FF;   /* brand blue tuned for dark surfaces */
    --warn:         #C9821A;
    --warn-soft:    #FBF1E1;
    --danger:       #B42318;
    --danger-soft:  #FDECEA;
    --ok:           #1F7A4D;
    --ok-soft:      #E5F4EC;
    --info:         #2D5F9A;
    --info-soft:    #E8F0F9;

    /* Shape & depth: radius is graded by hierarchy, shadows only on overlays */
    --r-panel:   10px;
    --r-control: 6px;
    --r-pill:    999px;
    --overlay-shadow: 0 12px 32px rgba(15, 27, 45, .16), 0 2px 6px rgba(15, 27, 45, .08);
    --focus: 0 0 0 3px rgba(26, 115, 232, .30);

    --font: 'IBM Plex Sans', 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --font-ar: 'IBM Plex Sans Arabic', 'IBM Plex Sans', system-ui, sans-serif;

    /* Legacy tokens used by dashboard.css, remapped to the new palette */
    --primary:       var(--accent);
    --primary-light: var(--accent-soft);
    --primary-dark:  var(--accent-hover);
    --purple:        var(--info);
    --purple-light:  var(--info-soft);
    --green:         var(--ok);
    --green-light:   var(--ok-soft);
    --amber:         var(--warn);
    --amber-light:   var(--warn-soft);
    --red:           var(--danger);
    --red-light:     var(--danger-soft);
    --gray-50:  #F8FAFA;
    --gray-100: #EEF2F3;
    --gray-200: var(--rule);
    --gray-300: var(--rule-strong);
    --gray-500: var(--text-3);
    --gray-700: var(--text-2);
    --gray-900: var(--text);
    --sidebar-w: 248px;
    --topbar-h:  60px;
    --radius:    var(--r-panel);
    --radius-sm: var(--r-control);
    --shadow:    none;
    --shadow-md: var(--overlay-shadow);
}

/* ── Base ─────────────────────────────────────────────────────────────── */
html { -webkit-text-size-adjust: 100%; }
body, body.ltr { font-family: var(--font); background: var(--canvas); color: var(--text); font-size: 14px; line-height: 1.5; }
body.rtl { font-family: var(--font-ar); }
h1, h2, h3, h4 { color: var(--ink); letter-spacing: -.01em; line-height: 1.25; }
.num, .fm-table td:nth-child(2), time { font-variant-numeric: tabular-nums; }
::selection { background: var(--accent-soft); }

a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible,
textarea:focus-visible, [tabindex]:focus-visible {
    outline: none; box-shadow: var(--focus); border-radius: var(--r-control);
}

/* ── Shell: sidebar ───────────────────────────────────────────────────── */
.ds-sidebar {
    width: var(--sidebar-w);
    background: var(--ink);
    color: #C6D0DE;
    border: 0;
    display: flex; flex-direction: column;
}
.ds-sidebar-logo {
    height: var(--topbar-h);
    display: flex; align-items: center; gap: 10px;
    padding: 0 20px;
    font-size: 1.15rem; font-weight: 700; letter-spacing: .02em;
    color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .06);
}
.ds-sidebar-logo span { color: var(--accent-line); }
.ds-sidebar-logo .ds-logo-mark {
    width: 28px; height: 28px; border-radius: 7px; display: grid; place-items: center;
    background: var(--accent); color: #fff; font-size: .8rem;
}
.ds-nav { padding: 12px 10px; gap: 1px; overflow-y: auto; flex: 1; }
.ds-nav-group {
    padding: 16px 12px 6px; font-size: .75rem; font-weight: 500; color: #7D8AA0;
}
.ds-nav-group:first-child { padding-top: 4px; }
.ds-nav-item {
    position: relative;
    display: flex; align-items: center; gap: 12px;
    padding: 8px 12px; border-radius: var(--r-control);
    color: #C6D0DE; font-size: .875rem; font-weight: 500; text-decoration: none;
    background: transparent;
}
.ds-nav-item i { width: 18px; text-align: center; font-size: .9rem; color: #8B98AD; }
.ds-nav-item:hover { background: rgba(255, 255, 255, .06); color: #fff; }
.ds-nav-item:hover i { color: #fff; }
.ds-nav-item.active { background: var(--ink-2); color: #fff; }
.ds-nav-item.active i { color: var(--accent-line); }
.ds-nav-item.active::before {
    content: ''; position: absolute; inset-inline-start: -10px; top: 6px; bottom: 6px;
    width: 3px; border-radius: 0 3px 3px 0; background: var(--accent-line);
}
.rtl .ds-nav-item.active::before { border-radius: 3px 0 0 3px; }
.ds-nav-count, .ds-nav-badge-new {
    margin-inline-start: auto; font-size: .7rem; font-weight: 600; line-height: 1;
    padding: 3px 7px; border-radius: var(--r-pill);
    background: rgba(122, 176, 255, .16); color: var(--accent-line);
}
.rtl .ds-nav-badge-new { margin-left: 0; margin-right: 0; }

.ds-storage {
    display: block; margin: 0 12px 12px; padding: 12px; border-radius: var(--r-control);
    background: var(--ink-2); border: 1px solid rgba(255, 255, 255, .06); color: #C6D0DE; text-decoration: none;
}
.ds-storage:hover { border-color: rgba(122, 176, 255, .45); }
.ds-storage-top { display: flex; justify-content: space-between; align-items: baseline; font-size: .78rem; color: #A3AFC2; margin-bottom: 8px; }
.ds-storage-top strong { color: #fff; font-size: .8rem; font-variant-numeric: tabular-nums; }
.ds-storage-bar { height: 4px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .1); overflow: hidden; }
.ds-storage-bar span { display: block; height: 100%; background: var(--accent-line); border-radius: inherit; }
.ds-storage-bar span.is-warn   { background: #E8A43C; }
.ds-storage-bar span.is-danger { background: #F06A5D; }
.ds-storage-sub { margin-top: 6px; font-size: .72rem; color: #7D8AA0; font-variant-numeric: tabular-nums; direction: ltr; text-align: start; }

.ds-sidebar-footer { padding: 12px; border-top: 1px solid rgba(255, 255, 255, .06); }
.ds-user-avatar { background: var(--ink-3); color: #fff; }
.ds-user-name { color: #fff; }
.ds-user-role { color: #7D8AA0; }
.ds-logout-btn { color: #8B98AD; }
.ds-logout-btn:hover { color: #fff; background: rgba(255, 255, 255, .06); }

/* ── Shell: topbar ────────────────────────────────────────────────────── */
.ds-topbar {
    height: var(--topbar-h); background: var(--panel); border-bottom: 1px solid var(--rule);
    box-shadow: none; display: flex; align-items: center; gap: 16px; padding: 0 24px;
}
.ds-topbar-title { font-size: .95rem; font-weight: 600; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.ds-topbar-search {
    position: relative; display: flex; align-items: center; gap: 8px;
    margin-inline-start: auto; width: min(360px, 40vw); height: 36px; padding: 0 10px;
    background: var(--canvas); border: 1px solid var(--rule); border-radius: var(--r-control);
}
.ds-topbar-search:focus-within { background: var(--panel); border-color: var(--accent); box-shadow: var(--focus); }
.ds-topbar-search i { color: var(--text-3); font-size: .85rem; }
.ds-topbar-search input { flex: 1; min-width: 0; border: 0; background: transparent; font-size: .875rem; color: var(--text); outline: none; }
.ds-kbd {
    font: 500 .7rem/1 var(--font); color: var(--text-3); border: 1px solid var(--rule);
    border-radius: 4px; padding: 3px 6px; background: var(--panel);
}
.ds-topbar-actions { display: flex; align-items: center; gap: 4px; }
.ds-icon-btn, .ds-lang-btn {
    position: relative; height: 36px; min-width: 36px; padding: 0 10px;
    display: inline-grid; place-items: center; border-radius: var(--r-control);
    border: 0; background: transparent; color: var(--text-2); font: 500 .8rem var(--font);
    cursor: pointer; text-decoration: none;
}
.ds-icon-btn:hover, .ds-lang-btn:hover { background: var(--gray-100); color: var(--ink); }
.ds-dot {
    position: absolute; top: 6px; inset-inline-end: 6px; min-width: 16px; height: 16px; padding: 0 4px;
    border-radius: var(--r-pill); background: var(--danger); color: #fff;
    font-size: .65rem; font-weight: 600; line-height: 16px; text-align: center; border: 2px solid var(--panel);
    box-sizing: content-box;
}
.ds-topbar-avatar {
    width: 32px; height: 32px; border-radius: 50%; border: 0; cursor: pointer;
    background: var(--ink); color: #fff; font: 600 .8rem var(--font); display: grid; place-items: center;
}

/* Dropdown menus (notifications, user menu) */
.ds-menu { position: relative; }
.ds-dropdown {
    position: absolute; top: calc(100% + 8px); inset-inline-end: 0; z-index: 300;
    width: 320px; max-width: calc(100vw - 24px);
    background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-panel);
    box-shadow: var(--overlay-shadow); display: none; overflow: hidden;
}
.ds-dropdown.open { display: block; }
.ds-dropdown-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid var(--rule); font-weight: 600; color: var(--ink); }
.ds-dropdown-head button { border: 0; background: none; color: var(--accent); font: 500 .8rem var(--font); cursor: pointer; }
.ds-dropdown-list { max-height: 360px; overflow-y: auto; }
.ds-dropdown-item {
    display: flex; gap: 12px; padding: 10px 16px; color: var(--text); text-decoration: none;
    border-bottom: 1px solid var(--gray-100); font-size: .85rem; background: none; border-inline: 0; border-top: 0;
    width: 100%; text-align: start; cursor: pointer; font-family: inherit;
}
.ds-dropdown-item:last-child { border-bottom: 0; }
.ds-dropdown-item:hover { background: var(--gray-50); }
.ds-dropdown-item i { width: 16px; color: var(--text-3); margin-top: 3px; }
.ds-dropdown-item.unread { background: var(--accent-soft); }
.ds-dropdown-item small { display: block; color: var(--text-3); font-size: .75rem; margin-top: 2px; }
.ds-dropdown-empty { padding: 28px 16px; text-align: center; color: var(--text-3); font-size: .85rem; }
.ds-dropdown-foot { display: block; padding: 10px 16px; text-align: center; border-top: 1px solid var(--rule); color: var(--accent); font-weight: 500; font-size: .85rem; text-decoration: none; }
.ds-user-menu { width: 240px; }
.ds-user-menu .ds-dropdown-head { flex-direction: column; align-items: flex-start; gap: 2px; }
.ds-user-menu .ds-dropdown-head small { color: var(--text-3); font-weight: 400; font-size: .78rem; }
.ds-dropdown-item.is-danger, .ds-dropdown-item.is-danger i { color: var(--danger); }

/* ── Content area ─────────────────────────────────────────────────────── */
.ds-content { padding: 28px 32px 40px; max-width: 1440px; width: 100%; }
.ds-footer { padding: 16px 32px; border-top: 1px solid var(--rule); color: var(--text-3); font-size: .78rem; background: transparent; }

/* Page header: title, one-line description, actions on the opposite side */
.ui-page-head, .ds-page-header {
    display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap;
    margin-bottom: 24px;
}
.ui-page-head h1, .ds-page-title { font-size: 1.5rem; font-weight: 600; color: var(--ink); }
.ui-page-head p, .ds-page-sub { color: var(--text-2); margin-top: 4px; font-size: .9rem; max-width: 72ch; }
.ui-page-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ── Panels ───────────────────────────────────────────────────────────── */
.ui-panel, .ds-card, .ds-usage-card, .ds-progress-card, .fm-panel {
    background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-panel); box-shadow: none;
}
.ui-panel-head {
    display: flex; align-items: center; justify-content: space-between; gap: 12px;
    padding: 14px 20px; border-bottom: 1px solid var(--rule);
}
.ui-panel-head h2 { font-size: 1rem; font-weight: 600; }
.ui-panel-head p { color: var(--text-3); font-size: .8rem; }
.ui-panel-body { padding: 20px; }
.ui-grid { display: grid; gap: 16px; }
.ui-grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.ui-grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.ui-grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }

/* Metric: label on top, figure below; no icon tiles, no gradients */
.ui-grid > .ui-panel, .ui-grid > section { margin: 0; }
.ui-metric { padding: 16px 20px; display: flex; flex-direction: column; min-height: 100%; }
.ui-metric .ui-meter { margin-top: auto; padding-top: 0; }
.ui-metric .ui-metric-sub + .ui-meter { margin-top: 12px; }
.ui-metric-label { color: var(--text-2); font-size: .8rem; display: flex; align-items: center; gap: 8px; }
.ui-metric-value { font-size: 1.6rem; font-weight: 600; color: var(--ink); margin-top: 6px; font-variant-numeric: tabular-nums; }
.ui-metric-sub { color: var(--text-3); font-size: .78rem; margin-top: 2px; }
.ui-meter { height: 6px; border-radius: var(--r-pill); background: var(--gray-100); overflow: hidden; margin-top: 12px; }
.ui-meter > span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.ui-meter > span.is-warn { background: var(--warn); }
.ui-meter > span.is-danger { background: var(--danger); }

/* ── Buttons ──────────────────────────────────────────────────────────── */
.ui-btn, .fm-btn {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px;
    height: 36px; padding: 0 14px; border-radius: var(--r-control);
    border: 1px solid var(--rule-strong); background: var(--panel); color: var(--text);
    font: 500 .85rem var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
    transition: background .12s, border-color .12s, color .12s;
}
.ui-btn:hover, .fm-btn:hover { background: var(--gray-50); border-color: var(--text-3); }
.ui-btn-primary, .fm-btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.ui-btn-primary:hover, .fm-btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); color: #fff; }
.ui-btn-danger, .fm-btn-del { background: var(--panel); border-color: #E7B4AE; color: var(--danger); }
.ui-btn-danger:hover, .fm-btn-del:hover { background: var(--danger); border-color: var(--danger); color: #fff; }
.ui-btn-ghost, .fm-btn-secondary, .fm-btn-outline { background: var(--panel); }
.ui-btn-sm, .fm-btn-sm { height: 30px; padding: 0 10px; font-size: .8rem; }
.ui-btn:disabled, .fm-btn:disabled { opacity: .55; cursor: not-allowed; }

.fm-action-btn {
    width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: var(--r-control);
    border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer;
}
.fm-action-btn:hover { background: var(--gray-100); color: var(--ink); border-color: var(--rule); }
.fm-action-danger { background: transparent; color: var(--danger); }
.fm-action-danger:hover { background: var(--danger-soft); color: var(--danger); border-color: #F2C4BE; }

/* ── Forms ────────────────────────────────────────────────────────────── */
.ui-field { display: flex; flex-direction: column; gap: 6px; }
.ui-label, .fm-label { font-size: .8rem; font-weight: 500; color: var(--text-2); }
.ui-input, .fm-input, .fm-filter-select, .ui-select {
    height: 36px; width: 100%; padding: 0 10px; border-radius: var(--r-control);
    border: 1px solid var(--rule-strong); background: var(--panel); color: var(--text);
    font: 400 .875rem var(--font);
}
textarea.ui-input { height: auto; padding: 8px 10px; }
.ui-input:focus, .fm-input:focus, .fm-filter-select:focus, .ui-select:focus { border-color: var(--accent); box-shadow: var(--focus); outline: none; }
.ui-hint { font-size: .75rem; color: var(--text-3); }
.ui-check { display: flex; align-items: center; gap: 8px; font-size: .875rem; cursor: pointer; }
.ui-check input { accent-color: var(--accent); width: 16px; height: 16px; }

/* ── Tables ───────────────────────────────────────────────────────────── */
/* Logos (public/assets/images) */
.ds-sidebar-logo img { display: block; height: 22px; width: auto; }
.ds-sidebar-logo .ds-logo-symbol { height: 26px; }

.ui-table-wrap, .fm-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ui-table, .fm-table, .fm-shares-table { width: 100%; border-collapse: collapse; font-size: .85rem; background: var(--panel); }
.ui-table th, .fm-table th, .fm-shares-table th {
    padding: 10px 16px; text-align: start; font-weight: 500; font-size: .78rem; color: var(--text-2);
    background: var(--gray-50); border-bottom: 1px solid var(--rule); white-space: nowrap;
}
.ui-table td, .fm-table td, .fm-shares-table td { padding: 10px 16px; border-bottom: 1px solid var(--gray-100); color: var(--text); vertical-align: middle; }
.ui-table tbody tr:hover, .fm-table tbody tr:hover { background: #F7F9FC; }
.ui-table tbody tr:last-child td, .fm-table tbody tr:last-child td { border-bottom: 0; }
.ui-table .muted, .ui-muted { color: var(--text-3); }

/* ── Badges, alerts ───────────────────────────────────────────────────── */
.ui-badge {
    display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: var(--r-pill);
    font-size: .72rem; font-weight: 500; background: var(--gray-100); color: var(--text-2); white-space: nowrap;
}
.ui-badge-accent { background: var(--accent-soft); color: var(--accent-hover); }
.ui-badge-ok     { background: var(--ok-soft); color: var(--ok); }
.ui-badge-warn   { background: var(--warn-soft); color: #8A5A10; }
.ui-badge-danger { background: var(--danger-soft); color: var(--danger); }
.ui-badge-info   { background: var(--info-soft); color: var(--info); }

.ui-alert, .fm-alert {
    display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; margin-bottom: 16px;
    border-radius: var(--r-control); border: 1px solid; font-size: .875rem;
}
.ui-alert-success, .fm-alert-success { background: var(--ok-soft); border-color: #B9DFC9; color: #14532D; }
.ui-alert-error, .fm-alert-error     { background: var(--danger-soft); border-color: #F2C4BE; color: #7A1A12; }
.ui-alert-info, .fm-alert-info       { background: var(--info-soft); border-color: #C5D7EE; color: #1E3F66; }
.ui-alert-warn                       { background: var(--warn-soft); border-color: #EFD3A5; color: #6B460C; }

/* ── Tabs ─────────────────────────────────────────────────────────────── */
.ui-tabs, .fm-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--rule); margin-bottom: 20px; overflow-x: auto; }
.ui-tab, .fm-tab {
    padding: 10px 14px; border: 0; background: none; border-bottom: 2px solid transparent; margin-bottom: -1px;
    color: var(--text-2); font: 500 .875rem var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
    border-radius: 0;
}
.ui-tab:hover, .fm-tab:hover { color: var(--ink); }
.ui-tab.active, .fm-tab.active { color: var(--accent); border-bottom-color: var(--accent); background: none; }

/* ── Modals ───────────────────────────────────────────────────────────── */
.fm-modal-backdrop { background: rgba(15, 27, 45, .45); backdrop-filter: blur(2px); }
.fm-modal {
    background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-panel);
    box-shadow: var(--overlay-shadow);
}
.fm-modal-header { padding: 16px 20px; border-bottom: 1px solid var(--rule); font-weight: 600; color: var(--ink); font-size: 1rem; }
.fm-modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
.fm-modal-footer { padding: 12px 20px; border-top: 1px solid var(--rule); background: var(--gray-50); display: flex; justify-content: flex-end; gap: 8px; border-radius: 0 0 var(--r-panel) var(--r-panel); }
.fm-modal-close { border: 0; background: none; color: var(--text-3); font-size: 1.4rem; cursor: pointer; width: 32px; height: 32px; border-radius: var(--r-control); }
.fm-modal-close:hover { background: var(--gray-100); color: var(--ink); }

/* ── Empty states ─────────────────────────────────────────────────────── */
.ui-empty, .fm-empty, .ds-empty-state {
    text-align: center; padding: 48px 24px; color: var(--text-2);
}
.ui-empty i, .fm-empty i, .ds-empty-icon { color: var(--rule-strong); font-size: 2.2rem; margin-bottom: 12px; }
.ui-empty h3 { font-size: 1rem; color: var(--ink); margin-bottom: 4px; }
.ui-empty p, .fm-empty p { font-size: .875rem; color: var(--text-3); margin-bottom: 16px; }

/* ── Activity feed / list rows ────────────────────────────────────────── */
.ui-feed { list-style: none; margin: 0; padding: 0; }
.ui-feed li { display: flex; gap: 12px; padding: 12px 20px; border-bottom: 1px solid var(--gray-100); align-items: flex-start; }
.ui-feed li:last-child { border-bottom: 0; }
.ui-feed-icon {
    flex: none; width: 30px; height: 30px; border-radius: var(--r-control); display: grid; place-items: center;
    background: var(--gray-100); color: var(--text-2); font-size: .8rem;
}
.ui-feed-icon.is-accent { background: var(--accent-soft); color: var(--accent); }
.ui-feed-icon.is-danger { background: var(--danger-soft); color: var(--danger); }
.ui-feed-icon.is-warn   { background: var(--warn-soft); color: var(--warn); }
.ui-feed-text { flex: 1; min-width: 0; font-size: .85rem; }
.ui-feed-text strong { font-weight: 600; color: var(--ink); }
.ui-feed-meta { color: var(--text-3); font-size: .75rem; margin-top: 2px; }

/* File-type chip used in lists */
.ui-file { display: flex; align-items: center; gap: 10px; min-width: 0; }
.ui-file i { width: 18px; text-align: center; color: var(--text-3); }
.ui-file span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ── Toasts ───────────────────────────────────────────────────────────── */
.ui-toasts { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 1000; display: flex; flex-direction: column; gap: 8px; }
.ui-toast {
    min-width: 240px; max-width: 380px; padding: 12px 14px; border-radius: var(--r-control);
    background: var(--ink); color: #fff; font-size: .85rem; box-shadow: var(--overlay-shadow);
    display: flex; gap: 10px; align-items: center; animation: ui-toast-in .18s ease-out;
}
.ui-toast.is-error { background: var(--danger); }
@keyframes ui-toast-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Skip link ────────────────────────────────────────────────────────── */
.ds-skip-link { position: absolute; top: -48px; inset-inline-start: 12px; z-index: 1000; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: var(--r-control); font-weight: 500; text-decoration: none; }
.ds-skip-link:focus { top: 12px; }
.ds-content:focus { outline: none; }

/* ── Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
    .ui-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .ui-grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 768px) {
    .ds-content { padding: 20px 16px 32px; }
    .ds-topbar { padding: 0 12px; gap: 8px; }
    .ds-topbar-title { display: none; }
    .ds-topbar-search { display: flex; width: auto; flex: 1; margin-inline-start: 0; }
    .ds-kbd { display: none; }
    .ui-grid-4, .ui-grid-3, .ui-grid-2 { grid-template-columns: minmax(0, 1fr); }
    .ui-page-head h1, .ds-page-title { font-size: 1.25rem; }
    .ui-page-actions { width: 100%; }
    .ds-footer { padding: 16px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
.fm-link-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; width: 100%; }
@media (max-width: 600px) { .fm-link-options { grid-template-columns: 1fr; } }
.fm-share-form:has(.fm-link-options) { flex-direction: column; align-items: stretch; gap: 12px; }

/* Utilities */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Activity page */
.act-filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--rule); align-items: end; }
.act-filter-btns { display: flex; gap: 8px; }
.act-pager { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; border-top: 1px solid var(--rule); font-size: .85rem; }

/* Home */
.home-split { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 2fr); gap: 16px; align-items: stretch; }
.home-split > .ui-panel { margin: 0; }
.home-split .ui-feed li { padding: 9px 20px; }
.home-metric-link { color: inherit; text-decoration: none; }
.home-metric-link:hover { border-color: var(--rule-strong); background: #FBFCFE; }
.home-plan .ui-metric-value { font-size: 1.4rem; }
.home-plan a { color: var(--accent); text-decoration: none; font-weight: 500; }
.home-app { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 20px; flex-wrap: wrap; }
.home-app h2 { font-size: 1rem; }
.home-app p { font-size: .85rem; margin-top: 2px; }
@media (max-width: 1100px) { .home-split { grid-template-columns: minmax(0, 1fr); } }

/* Layout guards: let the main column shrink instead of overflowing the viewport */
.ds-main { min-width: 0; }
.ds-content { min-width: 0; }

/* Sizes, counts and dates stay left-to-right inside Arabic pages */
.rtl .ui-metric-value, .rtl td.num { direction: ltr; text-align: right; unicode-bidi: isolate; }

/* ==========================================================================
   Modal shell
   Shared by .fm-modal-* (files, team files, profile) and the .tw-modal-*
   backdrops used by team and cPanel pages. Moved here from dashboard.css.
   ========================================================================== */
.fm-modal-backdrop, .tw-modal-backdrop {
    display: none; position: fixed; inset: 0; z-index: 1000;
    align-items: center; justify-content: center; padding: 16px;
    background: rgba(14, 42, 51, .45);
}
.fm-modal-backdrop.show, .tw-modal-backdrop.show { display: flex; }
.fm-modal {
    width: 100%; max-width: 480px; max-height: calc(100vh - 32px);
    display: flex; flex-direction: column; overflow: hidden; color: var(--text);
    animation: ui-modal-in .16s ease-out;
}
.fm-modal > form { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.fm-modal-sm { max-width: 380px; }
.fm-modal-lg { max-width: 640px; }
.fm-modal-xl { max-width: 960px; }
.fm-modal-header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.fm-modal-header > span, .fm-modal-header h3 {
    min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    font-size: 1rem; font-weight: 600; color: var(--ink); margin: 0;
}
.fm-modal-header em { font-style: normal; color: var(--text-2); font-weight: 500; }
.fm-modal-close { flex: none; display: inline-grid; place-items: center; line-height: 1; }
.fm-modal-body { overflow-y: auto; min-height: 0; }
.fm-modal-body > p { margin: 0; color: var(--text-2); }
.fm-modal-footer { flex-wrap: wrap; }
.fm-modal-footer form { display: flex; gap: 8px; flex-wrap: wrap; }
@keyframes ui-modal-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ==========================================================================
   File manager
   ========================================================================== */
.fm-wrap { display: flex; flex-direction: column; gap: 16px; }
.fm-panel-hidden { display: none !important; }
.fm-wrap > .fm-tabs { margin-bottom: 0; }

/* Page head: breadcrumb above the title */
.fm-breadcrumb {
    display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
    font-size: .8rem; color: var(--text-3); margin-bottom: 4px;
}
.fm-breadcrumb a { color: var(--text-2); text-decoration: none; font-weight: 500; }
.fm-breadcrumb a:hover { color: var(--accent); text-decoration: underline; }
.fm-breadcrumb [aria-current] { color: var(--text-3); }
.fm-bc-sep { color: var(--rule-strong); font-size: .6rem; display: inline-flex; }
.rtl .fm-bc-sep i { transform: scaleX(-1); }
.ui-page-head h1 { overflow-wrap: anywhere; }

/* Storage quota */
.fm-quota { padding: 12px 20px; }
.fm-quota-label {
    display: flex; justify-content: space-between; align-items: baseline; gap: 8px; flex-wrap: wrap;
    font-size: .85rem; color: var(--text-2);
}
.fm-quota-label i { color: var(--text-3); margin-inline-end: 6px; }
.fm-quota-label .num { color: var(--text-2); direction: ltr; unicode-bidi: isolate; }
.fm-quota-label .num strong { color: var(--ink); font-weight: 600; }
.fm-quota .ui-meter { margin-top: 8px; }
.fm-quota-warn { margin-top: 8px; font-size: .8rem; color: #8A5A10; display: flex; gap: 6px; align-items: baseline; }

/* Sections inside the files panel */
.fm-section { margin: 0; padding: 16px 20px 20px; border-bottom: 1px solid var(--rule); }
.fm-section-label {
    display: flex; align-items: center; gap: 8px; margin: 0 0 12px;
    font-size: .875rem; font-weight: 600; color: var(--ink);
}
.fm-section-label .ui-badge { font-weight: 500; }

/* Folder cards */
.fm-folders-grid, .fm-grid {
    display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px;
}
.fm-folder-card {
    position: relative; display: flex; align-items: center; gap: 10px; min-width: 0;
    padding: 10px 8px 10px 12px; padding-inline: 12px 6px;
    background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-control);
    color: var(--text); text-decoration: none; cursor: pointer; user-select: none;
    transition: border-color .12s, background .12s;
}
.fm-folder-card:hover { border-color: var(--rule-strong); background: var(--gray-50); }
.fm-folder-card.fm-ctx-active { border-color: var(--accent); background: var(--accent-soft); }
.fm-folder-card:focus-visible { box-shadow: var(--focus); }
.fm-folder-icon { flex: none; font-size: 1.15rem; line-height: 1; color: var(--warn); }
.fm-folder-icon i { color: var(--warn); }
.fm-folder-text { flex: 1; min-width: 0; }
.fm-folder-name {
    font-size: .85rem; font-weight: 500; color: var(--ink);
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.fm-folder-meta { font-size: .75rem; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-folder-card .fm-folder-menu-btn,
.fm-row-menu-btn {
    flex: none; width: 28px; height: 28px; display: inline-grid; place-items: center;
    border: 0; background: transparent; border-radius: var(--r-control);
    color: var(--text-3); cursor: pointer;
}
.fm-folder-card .fm-folder-menu-btn:hover, .fm-row-menu-btn:hover { background: var(--gray-100); color: var(--ink); }

/* Favourite star */
.fm-fav-btn {
    flex: none; width: 28px; height: 28px; display: inline-grid; place-items: center;
    border: 0; background: transparent; border-radius: var(--r-control);
    color: var(--rule-strong); cursor: pointer; font-size: .85rem; line-height: 1;
}
.fm-fav-btn:hover { color: var(--warn); background: var(--gray-100); }
.fm-fav-btn.fm-fav-active { color: var(--warn); }

/* Filters bar */
.fm-filters-bar {
    display: grid; grid-template-columns: minmax(200px, 2fr) repeat(4, minmax(120px, 1fr)) auto;
    gap: 10px 12px; align-items: end; padding: 14px 20px; border-bottom: 1px solid var(--rule);
    background: var(--gray-50);
}
.fm-filter-group { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.fm-filter-label { font-size: .78rem; font-weight: 500; color: var(--text-2); }
.fm-search-inner { position: relative; display: flex; align-items: center; }
.fm-search-inner i {
    position: absolute; inset-inline-start: 10px; color: var(--text-3); font-size: .8rem; pointer-events: none;
}
.fm-search-inner .fm-input { padding-inline-start: 30px; }
.fm-filter-select, .fm-filter-date { min-width: 0; }

/* File table */
.fm-file-name { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 500; color: var(--ink); }
.fm-file-name i { flex: none; width: 18px; text-align: center; color: var(--text-3); font-size: 1rem; }
.fm-file-name span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fm-table td.fm-file-cell { max-width: 420px; }
.fm-table tbody tr { cursor: default; }
.fm-table tbody tr.fm-ctx-active { background: var(--accent-soft); }
.fm-table .fm-col-num, .fm-table .fm-col-type { white-space: nowrap; color: var(--text-2); font-variant-numeric: tabular-nums; }
.fm-table th.fm-col-actions, .fm-table td.fm-row-actions { width: 1%; white-space: nowrap; text-align: end; }
.fm-row-actions-in { display: inline-flex; align-items: center; gap: 2px; }
.fm-th-sort { cursor: pointer; user-select: none; }
.fm-th-sort:hover { color: var(--ink); }
.fm-th-sort .fm-sort-icon { margin-inline-start: 4px; font-size: .7rem; color: var(--rule-strong); }
.fm-th-sort.fm-sort-asc, .fm-th-sort.fm-sort-desc { color: var(--ink); }
.fm-th-sort.fm-sort-asc .fm-sort-icon, .fm-th-sort.fm-sort-desc .fm-sort-icon { color: var(--accent); }
.fm-empty-inline { text-align: center; color: var(--text-3); font-size: .875rem; padding: 24px 16px; }
.fm-actions-cell { display: flex; gap: 4px; align-items: center; justify-content: flex-end; }
.fm-load-more-wrap {
    display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
    padding: 12px 20px; border-top: 1px solid var(--rule);
}
.fm-showing-info { font-size: .8rem; color: var(--text-3); }
.rtl .fm-table td.fm-col-num, .rtl .ui-table td.ui-col-num { direction: ltr; text-align: right; }

/* Context menu (overlay: shadow allowed) */
.fm-ctx-menu {
    position: fixed; z-index: 9999; min-width: 200px; padding: 4px;
    background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-control);
    box-shadow: var(--overlay-shadow); animation: ui-modal-in .1s ease-out;
}
.fm-ctx-item {
    display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 4px;
    font-size: .85rem; color: var(--text); cursor: pointer;
}
.fm-ctx-item:hover { background: var(--gray-100); color: var(--ink); }
.fm-ctx-item i { width: 16px; text-align: center; color: var(--text-3); }
.fm-ctx-danger, .fm-ctx-danger i { color: var(--danger); }
.fm-ctx-danger:hover { background: var(--danger-soft); color: var(--danger); }
.fm-ctx-sep { height: 1px; background: var(--rule); margin: 4px 0; }

/* Flash link alert */
.fm-alert-info { flex-wrap: wrap; align-items: center; }
.fm-public-link-val {
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; word-break: break-all;
    direction: ltr; unicode-bidi: isolate; background: var(--panel); border: 1px solid #C5D7EE;
    border-radius: 4px; padding: 2px 6px;
}
.fm-copy-btn {
    height: 28px; padding: 0 10px; border-radius: var(--r-control); border: 1px solid var(--info);
    background: var(--info); color: #fff; font: 500 .8rem var(--font); cursor: pointer;
}
.fm-copy-btn:hover { background: #244F82; }

/* Upload: drop zone + queue */
.fm-drop-zone {
    display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
    padding: 28px 16px; border: 1.5px dashed var(--rule-strong); border-radius: var(--r-panel);
    background: var(--gray-50); color: var(--text-2); cursor: pointer; transition: background .12s, border-color .12s;
}
.fm-drop-zone > i { font-size: 1.8rem; color: var(--accent); margin-bottom: 4px; }
.fm-drop-zone p { margin: 0; }
.fm-drop-zone #fmDropLabel { font-weight: 500; color: var(--ink); }
.fm-drop-zone:hover, .fm-drop-zone.drag-over { background: var(--accent-soft); border-color: var(--accent); }
.fm-max-size-hint, .fm-allowed-types-hint { font-size: .75rem; color: var(--text-3); max-width: 52ch; }
.fm-file-input { display: none; }
.fm-queue-header { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; font-size: .8rem; color: var(--text-2); }
.fm-queue-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; max-height: 280px; overflow-y: auto; }
.fm-queue-item {
    display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(90px, 140px) 20px 24px; align-items: center; gap: 10px;
    padding: 8px 10px; font-size: .8rem; background: var(--panel);
    border: 1px solid var(--rule); border-radius: var(--r-control);
}
.fm-queue-item.uploading { border-color: var(--accent-line); }
.fm-queue-item.done      { background: var(--ok-soft); border-color: #B9DFC9; }
.fm-queue-item.failed    { background: var(--danger-soft); border-color: #F2C4BE; }
.fm-qi-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 500; color: var(--ink); }
.fm-qi-size { color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fm-qi-progress { display: flex; align-items: center; gap: 6px; }
.fm-qi-bar  { flex: 1; height: 4px; background: var(--gray-100); border-radius: var(--r-pill); overflow: hidden; }
.fm-qi-fill { height: 100%; width: 0; background: var(--accent); border-radius: inherit; transition: width .2s; }
.fm-qi-pct  { font-size: .72rem; color: var(--text-3); min-width: 2.6em; text-align: end; font-variant-numeric: tabular-nums; }
.fm-qi-status { text-align: center; color: var(--text-3); }
.fm-qi-remove { border: 0; background: none; cursor: pointer; color: var(--text-3); width: 24px; height: 24px; border-radius: 4px; }
.fm-qi-remove:hover { color: var(--danger); background: var(--danger-soft); }

/* Share modals */
.fm-share-section { display: flex; flex-direction: column; gap: 10px; padding-bottom: 16px; border-bottom: 1px solid var(--rule); }
.fm-share-section:last-child { border-bottom: 0; padding-bottom: 0; }
.fm-share-section h4 { margin: 0; font-size: .875rem; font-weight: 600; color: var(--ink); }
.fm-share-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.fm-share-form > .fm-btn { flex: none; }
.fm-share-form:has(.fm-link-options) > .fm-btn { align-self: flex-start; }
.fm-user-search-wrap { position: relative; flex: 1; min-width: 180px; }
.fm-user-dropdown {
    display: none; position: absolute; top: calc(100% + 4px); inset-inline: 0; z-index: 9999;
    list-style: none; margin: 0; padding: 4px; max-height: 220px; overflow-y: auto;
    background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-control); box-shadow: var(--overlay-shadow);
}
.fm-user-dropdown.open { display: block; }
.fm-user-dropdown li { padding: 8px 10px; border-radius: 4px; cursor: pointer; font-size: .85rem; color: var(--text); }
.fm-user-dropdown li:hover, .fm-user-dropdown li.active { background: var(--gray-100); }
.fm-user-dropdown .fm-ud-name { font-weight: 500; color: var(--ink); }
.fm-user-dropdown .fm-ud-email { font-size: .75rem; color: var(--text-3); }
.fm-user-dropdown li.fm-ud-empty { color: var(--text-3); cursor: default; }
.fm-shares-list { border: 1px solid var(--rule); border-radius: var(--r-control); overflow-x: auto; }
.fm-shares-list .fm-shares-table td { font-size: .8rem; }
.fm-shares-list .fm-shares-table td:nth-child(2) { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; direction: ltr; unicode-bidi: isolate; text-align: start; }
.fm-shares-list .fm-shares-table td:last-child { white-space: nowrap; text-align: end; }
.fm-shares-list .ui-badge { margin-inline-start: 4px; }
.fm-loading, .fm-no-shares, .fm-shares-list > p { margin: 0; padding: 14px; color: var(--text-3); font-size: .85rem; text-align: center; }
.fm-btn-dl { color: var(--text-2); }
.fm-action-btn.fm-btn-del { width: 30px; height: 30px; padding: 0; border-color: transparent; background: transparent; }
.fm-action-btn.fm-btn-del:hover { background: var(--danger-soft); color: var(--danger); border-color: #F2C4BE; }
.fm-move-sep { border: 0; border-top: 1px solid var(--rule); margin: 4px 0; }
.fm-preview-body { min-height: 200px; text-align: center; }

/* Favourite toast (files page) */
.fm-fav-toast { position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 1000; }
.fm-fav-toast i { color: #F2B65A; }

@media (max-width: 1100px) {
    .fm-filters-bar { grid-template-columns: repeat(3, minmax(0, 1fr)); }
    .fm-filters-bar .fm-filter-search { grid-column: 1 / -1; }
}
@media (max-width: 768px) {
    .fm-section, .fm-filters-bar, .fm-load-more-wrap { padding-inline: 14px; }
    .fm-filters-bar { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .fm-folders-grid, .fm-grid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); }
    .fm-table .fm-col-type, .fm-table th.fm-col-type-h { display: none; }
    .fm-quota { padding: 12px 14px; }
    .fm-queue-item { grid-template-columns: minmax(0, 1fr) auto 20px 24px; }
    .fm-queue-item .fm-qi-progress { grid-column: 1 / -1; grid-row: 2; }
}
@media (max-width: 420px) {
    .fm-filters-bar { grid-template-columns: minmax(0, 1fr); }
    .fm-folders-grid, .fm-grid { grid-template-columns: minmax(0, 1fr); }
}

/* ==========================================================================
   Team files (card grid)
   ========================================================================== */
.tf-layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 16px; align-items: start; }
.tf-workers { padding: 8px; }
.tf-workers-title { padding: 8px 10px 6px; font-size: .78rem; font-weight: 500; color: var(--text-3); }
.tf-worker-item {
    display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-control);
    color: var(--text); text-decoration: none; font-size: .85rem; min-width: 0;
}
.tf-worker-item span.tf-worker-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tf-worker-item:hover { background: var(--gray-100); color: var(--ink); }
.tf-worker-item.active { background: var(--accent-soft); color: var(--accent-hover); font-weight: 500; }
.tf-worker-item > i { width: 24px; text-align: center; color: var(--text-3); }
.tf-worker-item.active > i { color: var(--accent); }
.tf-worker-avatar {
    flex: none; width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center;
    background: var(--ink-3); color: #fff; font-size: .7rem; font-weight: 600;
}
.fm-card {
    position: relative; display: flex; flex-direction: column; min-width: 0; overflow: hidden;
    background: var(--panel); border: 1px solid var(--rule); border-radius: var(--r-control);
    transition: border-color .12s;
}
.fm-card:hover { border-color: var(--rule-strong); }
.fm-card-inner {
    flex: 1; display: flex; flex-direction: column; align-items: flex-start; gap: 4px;
    padding: 14px 14px 10px; color: inherit; text-decoration: none; min-width: 0;
}
a.fm-card-inner:hover .fm-card-name { color: var(--accent); }
.fm-card-icon { font-size: 1.4rem; line-height: 1; margin-bottom: 6px; color: var(--text-3); }
.fm-card-folder .fm-card-icon { color: var(--warn); }
.fm-card-name {
    width: 100%; font-size: .85rem; font-weight: 500; color: var(--ink); word-break: break-word;
    overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
}
.fm-card-meta { font-size: .75rem; color: var(--text-3); font-variant-numeric: tabular-nums; }
.fm-card-actions {
    display: flex; gap: 2px; padding: 4px 8px; border-top: 1px solid var(--gray-100);
    justify-content: flex-end; flex-wrap: wrap;
}
.fm-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.fm-tag { display: inline-flex; padding: 1px 7px; border-radius: var(--r-pill); background: var(--gray-100); color: var(--text-2); font-size: .7rem; font-weight: 500; }
@media (max-width: 900px) { .tf-layout { grid-template-columns: minmax(0, 1fr); } }

/* ==========================================================================
   List pages: favorites, shares, devices, team, cPanel
   ========================================================================== */
.ui-stack { display: flex; flex-direction: column; gap: 16px; }
.ui-panel-head h2 { display: flex; align-items: center; gap: 8px; margin: 0; }
.ui-panel-head h2 .ui-badge { font-weight: 500; }
.ui-panel .ui-empty { padding: 36px 24px; }
.ui-row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: nowrap; }
.ui-table th.ui-col-actions, .ui-table td.ui-col-actions { width: 1%; white-space: nowrap; text-align: end; }
.ui-table td.ui-col-actions form { display: inline; }
.ui-table .ui-col-num { white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--text-2); }
.ui-icon-btn {
    width: 30px; height: 30px; display: inline-grid; place-items: center; border-radius: var(--r-control);
    border: 1px solid transparent; background: transparent; color: var(--text-2); cursor: pointer; text-decoration: none;
}
.ui-icon-btn:hover { background: var(--gray-100); color: var(--ink); border-color: var(--rule); }
.ui-icon-btn.is-danger { color: var(--danger); }
.ui-icon-btn.is-danger:hover { background: var(--danger-soft); border-color: #F2C4BE; }
.ui-link-field { display: flex; align-items: center; gap: 6px; min-width: 220px; max-width: 380px; }
.ui-link-field .ui-input {
    height: 30px; font-size: .78rem; background: var(--gray-50); color: var(--text-2);
    direction: ltr; text-overflow: ellipsis;
}
.ui-quota { padding: 16px 20px; }
.ui-quota-top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.ui-quota-top .ui-metric-label { font-size: .85rem; }
.ui-quota-figure { font-size: 1.1rem; font-weight: 600; color: var(--ink); font-variant-numeric: tabular-nums; direction: ltr; unicode-bidi: isolate; }
.ui-quota .ui-metric-sub { margin-top: 8px; }
.ui-quota .ui-meter { margin-top: 10px; }

/* Toasts used by favorites / shares / cPanel / files (JS toggles .show + .success/.error) */
.fav-toast, .sh-toast, .cb-toast {
    position: fixed; bottom: 20px; inset-inline-end: 20px; z-index: 2000;
    display: none; align-items: center; gap: 10px; min-width: 240px; max-width: min(380px, calc(100vw - 40px));
    padding: 12px 14px; border-radius: var(--r-control); border: 0;
    background: var(--ink); color: #fff; font-size: .85rem; box-shadow: var(--overlay-shadow);
}
.fav-toast.show, .sh-toast.show { display: flex; }
.cb-toast.show { display: block; }
.fav-toast.error, .sh-toast.error, .cb-toast.error { background: var(--danger); color: #fff; }
.fav-toast.success, .sh-toast.success, .cb-toast.success { background: var(--ink); color: #fff; }

/* Team & cPanel modal forms */
.tw-pw-meter { height: 4px; background: var(--gray-100); border-radius: var(--r-pill); margin-top: 6px; overflow: hidden; }
.tw-pw-bar { height: 100%; width: 0; border-radius: inherit; transition: width .25s, background .25s; }
.tw-pw-meta { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 4px; }
.tw-pw-label { font-size: .75rem; font-weight: 600; white-space: nowrap; }
.tw-pw-meta .ui-hint { text-align: end; }
.ui-field-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; align-items: end; }
@media (max-width: 480px) { .ui-field-row { grid-template-columns: minmax(0, 1fr); } }
.ui-days { display: flex; flex-wrap: wrap; gap: 6px; }
.ui-day {
    display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px;
    border: 1px solid var(--rule-strong); border-radius: var(--r-control); font-size: .8rem; cursor: pointer;
}
.ui-day input { accent-color: var(--accent); }
.ui-day:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-hover); }

/* The logo lockup never mirrors: symbol stays before the wordmark in RTL too */
.rtl .ds-sidebar-logo { direction: ltr; justify-content: flex-end; }
/* Clip table/filter backgrounds to the rounded panel corners on list pages */
.fm-wrap > .fm-panel, .ui-stack > .ui-panel, .tf-layout > .ui-panel, section.ui-panel { overflow: hidden; }
/* File and folder names keep their own direction inside Arabic pages (e.g. "photo.jpg") */
.fm-file-name span, .fm-folder-name, .fm-card-name, .ui-file > span, .fm-qi-name { unicode-bidi: plaintext; }
.ui-link-status { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; padding-inline-start: 28px; }
