/* I2DS Documents — bilingual enterprise UI (IBM Plex Sans + Plex Sans Arabic) */
:root {
  --bg: #f4f2ee;
  --panel: #ffffff;
  --panel-2: #faf9f6;
  --ink: #17191c;
  --ink-2: #4a4f57;
  --ink-3: #8a8f98;
  --line: #e4e1da;
  --line-2: #d4d0c6;
  --accent: #0d6e6e;
  --accent-ink: #ffffff;
  --accent-soft: #e2f0ee;
  --gold: #b7791f;
  --gold-soft: #fbf1df;
  --danger: #b42318;
  --danger-soft: #fdecea;
  --ok: #157f3d;
  --ok-soft: #e6f4ea;
  --info-soft: #e8eef9;
  --side: #10201f;
  --side-ink: #c9d6d4;
  --side-hi: #ffffff;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(20, 20, 20, .04), 0 4px 16px rgba(20, 20, 20, .05);
  --font: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1213; --panel: #171b1d; --panel-2: #1c2123; --ink: #e8eaeb; --ink-2: #b4bbbf;
    --ink-3: #7c858a; --line: #262d30; --line-2: #333c40; --accent: #3fb6a8; --accent-ink: #062120;
    --accent-soft: #15302d; --gold: #e0a84c; --gold-soft: #2c2415; --danger: #f07167;
    --danger-soft: #331a18; --ok: #5cc98a; --ok-soft: #142a1d; --info-soft: #18223a;
    --side: #0a0d0e; --side-ink: #9aa7a6; color-scheme: dark;
    --shadow: 0 1px 2px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14.5px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { line-height: 1.25; margin: 0 0 .5rem; font-weight: 600; letter-spacing: -.01em; }
h1 { font-size: 1.55rem; } h2 { font-size: 1.15rem; } h3 { font-size: 1rem; }
small, .muted { color: var(--ink-3); }
code, .mono { font-family: var(--mono); font-size: .88em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.25rem 0; }

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 240px 1fr; min-height: 100vh; }
.side { background: var(--side); color: var(--side-ink); padding: 18px 14px; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--side-hi); font-weight: 600; padding: 4px 8px 18px; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: linear-gradient(135deg, #18a497, #0d6e6e 60%, #b7791f); display: grid; place-items: center; font-size: 13px; color: #fff; font-weight: 700; letter-spacing: .02em; }
.brand small { display: block; color: var(--side-ink); font-weight: 400; font-size: 11px; }
.nav-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: #6f8482; padding: 14px 10px 4px; }
.side a.nav { display: flex; gap: 10px; align-items: center; color: var(--side-ink); padding: 7px 10px; border-radius: 8px; }
.side a.nav:hover { background: rgba(255,255,255,.06); color: var(--side-hi); text-decoration: none; }
.side a.nav.active { background: rgba(63,182,168,.16); color: var(--side-hi); }
.side .grow { flex: 1; }
.side .me { border-top: 1px solid rgba(255,255,255,.08); padding: 12px 8px 0; font-size: 13px; }
.side .me b { color: var(--side-hi); font-weight: 500; display: block; }
.side .me form { display: inline; }
.side .me button { background: none; border: 0; color: var(--side-ink); padding: 0; cursor: pointer; font: inherit; text-decoration: underline; }
.main { min-width: 0; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 12px 28px; border-bottom: 1px solid var(--line); background: color-mix(in srgb, var(--bg) 85%, transparent); backdrop-filter: blur(8px); position: sticky; top: 0; z-index: 5; }
.searchbox { flex: 1; max-width: 680px; display: flex; align-items: center; gap: 8px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 999px; padding: 6px 8px 6px 16px; }
.searchbox:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.searchbox input { border: 0; outline: 0; background: transparent; flex: 1; font: inherit; color: var(--ink); padding: 3px 0; }
.ai-chip { font-size: 11px; font-weight: 600; letter-spacing: .04em; color: var(--accent); background: var(--accent-soft); border-radius: 999px; padding: 3px 9px; white-space: nowrap; }
.content { padding: 24px 28px 64px; max-width: 1280px; }
.btn.menu-toggle { display: none; }

/* ---------- components ---------- */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.card-pad { padding: 18px 20px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 20px; border-bottom: 1px solid var(--line); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.layout-detail { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 18px; align-items: start; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.stack > * + * { margin-top: 12px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head p { margin: 2px 0 0; color: var(--ink-2); max-width: 70ch; }

.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line-2); background: var(--panel); color: var(--ink); border-radius: 8px; padding: 7px 13px; font: inherit; font-weight: 500; cursor: pointer; white-space: nowrap; line-height: 1.3; }
.btn:hover { border-color: var(--ink-3); text-decoration: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { filter: brightness(1.08); border-color: var(--accent); }
.btn-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 35%, var(--line)); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

label { display: block; font-weight: 500; font-size: 13px; margin-bottom: 4px; color: var(--ink-2); }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=date], select, textarea {
  width: 100%; font: inherit; color: var(--ink); background: var(--panel); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { min-height: 84px; resize: vertical; }
.field { margin-bottom: 14px; }
.field .hint { font-size: 12px; color: var(--ink-3); margin-top: 3px; }
.check { display: flex; gap: 8px; align-items: center; font-weight: 400; color: var(--ink); }
.check input { width: auto; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px 14px; }

table.tbl { width: 100%; border-collapse: collapse; }
.tbl th { text-align: start; font-size: 12px; text-transform: uppercase; letter-spacing: .05em; color: var(--ink-3); font-weight: 600; padding: 9px 12px; border-bottom: 1px solid var(--line); background: var(--panel-2); }
.tbl td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tr:hover td { background: var(--panel-2); }
.tbl .num { text-align: end; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tbl-wrap { overflow-x: auto; }

.badge { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; padding: 2px 8px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); color: var(--ink-2); white-space: nowrap; }
.badge.cat { background: var(--gold-soft); border-color: transparent; color: var(--gold); font-weight: 500; }
.badge.ok { background: var(--ok-soft); color: var(--ok); border-color: transparent; }
.badge.bad { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.acc { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.tag { display: inline-block; font-size: 12px; color: var(--ink-2); background: var(--panel-2); border: 1px solid var(--line); border-radius: 6px; padding: 1px 7px; margin: 0 4px 4px 0; }
.tags { line-height: 1.9; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 10px; border: 1px solid transparent; word-break: break-word; }
.flash.success { background: var(--ok-soft); color: var(--ok); }
.flash.error { background: var(--danger-soft); color: var(--danger); }
.flash.info { background: var(--info-soft); color: var(--ink); }

.crumbs { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13px; color: var(--ink-3); margin-bottom: 8px; }
.crumbs a { color: var(--ink-2); }
.crumbs .sep { color: var(--line-2); }

/* file / folder tiles */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.tile { display: flex; gap: 12px; align-items: center; padding: 12px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); color: var(--ink); }
.tile:hover { border-color: var(--accent); text-decoration: none; box-shadow: var(--shadow); }
.tile .t { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tile small { display: block; }
.ficon { width: 34px; height: 40px; flex: none; border-radius: 5px; display: grid; place-items: center; font-size: 9.5px; font-weight: 700; letter-spacing: .03em; color: #fff; position: relative; }
.ficon::after { content: ""; position: absolute; top: 0; right: 0; border-width: 0 9px 9px 0; border-style: solid; border-color: transparent var(--bg) rgba(0,0,0,.18) transparent; }
.ficon.pdf { background: #c0392b; } .ficon.word { background: #2b5797; } .ficon.excel { background: #1e7145; }
.ficon.image { background: #8e44ad; } .ficon.slides { background: #d35400; } .ficon.text { background: #5d6d7e; }
.ficon.folder { background: var(--gold); border-radius: 4px 8px 6px 6px; width: 38px; height: 32px; }
.ficon.folder::after { display: none; }
.doc-title { font-weight: 500; color: var(--ink); }
.doc-title:hover { color: var(--accent); }
.doc-sum { color: var(--ink-2); font-size: 13px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 70ch; }
.why { font-size: 12.5px; color: var(--accent); margin-top: 2px; }
.why::before { content: "✦ "; }

/* upload */
.drop { border: 1.5px dashed var(--line-2); border-radius: var(--radius); padding: 22px; text-align: center; background: var(--panel-2); transition: .15s; cursor: pointer; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.drop b { color: var(--accent); }
.uplist { margin-top: 12px; display: grid; gap: 6px; text-align: start; }
.up { display: grid; grid-template-columns: 1fr auto; gap: 4px 10px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel); font-size: 13px; }
.up .bar { grid-column: 1 / -1; height: 4px; background: var(--line); border-radius: 4px; overflow: hidden; }
.up .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.up.err { border-color: var(--danger); } .up.err .bar i { background: var(--danger); }

/* stats */
.stat { padding: 16px 18px; }
.stat .v { font-size: 1.6rem; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stat .l { color: var(--ink-3); font-size: 12.5px; }
.bars { display: grid; gap: 7px; }
.bars .b { display: grid; grid-template-columns: 140px 1fr 48px; gap: 10px; align-items: center; font-size: 13px; }
.bars .track { height: 8px; background: var(--panel-2); border-radius: 6px; overflow: hidden; border: 1px solid var(--line); }
.bars .track i { display: block; height: 100%; background: var(--accent); }
.spark { display: flex; align-items: flex-end; gap: 4px; height: 70px; }
.spark i { flex: 1; background: var(--accent); opacity: .8; border-radius: 3px 3px 0 0; min-height: 2px; }

dialog { border: 1px solid var(--line); border-radius: 12px; padding: 0; width: min(560px, 94vw); background: var(--panel); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25); }
dialog::backdrop { background: rgba(10, 16, 16, .45); }
dialog .dh { padding: 16px 20px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
dialog .db { padding: 18px 20px; }
dialog .df { padding: 12px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; background: var(--panel-2); border-radius: 0 0 12px 12px; }

.preview { width: 100%; height: 72vh; border: 0; border-radius: var(--radius); background: var(--panel-2); }
.preview-img { max-width: 100%; max-height: 72vh; display: block; margin: 0 auto; border-radius: 6px; }
.meta dt { font-size: 12px; color: var(--ink-3); text-transform: uppercase; letter-spacing: .05em; margin-top: 12px; }
.meta dd { margin: 2px 0 0; }
.timeline { list-style: none; margin: 0; padding: 0; font-size: 13px; }
.timeline li { padding: 7px 0; border-bottom: 1px dashed var(--line); }
.timeline li:last-child { border: 0; }
.empty { text-align: center; padding: 40px 20px; color: var(--ink-3); }
.empty .ficon { margin: 0 auto 10px; }
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; background:
  radial-gradient(1000px 500px at 10% -10%, var(--accent-soft), transparent 60%),
  radial-gradient(800px 400px at 110% 110%, var(--gold-soft), transparent 60%), var(--bg); }
.auth { width: min(400px, 100%); }
.auth .brand { color: var(--ink); padding: 0 0 18px; }
.auth .brand small { color: var(--ink-3); }
.ai-status { font-size: 12px; }
.linkbox { display: flex; gap: 8px; } .linkbox input { font-family: var(--mono); font-size: 12.5px; }
.sticky-actions { position: sticky; bottom: 12px; display: none; margin-top: 10px; padding: 10px 14px; background: var(--side); color: #fff; border-radius: 10px; align-items: center; gap: 10px; flex-wrap: wrap; }
.sticky-actions.show { display: flex; }
.sticky-actions select { width: auto; padding: 5px 8px; }
[dir=auto] { unicode-bidi: plaintext; }
.search-grid { grid-template-columns: 1fr 190px 150px auto; align-items: end; }
@media (max-width: 780px) { .search-grid { grid-template-columns: 1fr; } }

@media (max-width: 1000px) {
  .layout-detail { grid-template-columns: 1fr; }
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: 1fr; }
}
@media (max-width: 780px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: fixed; inset: 0 auto 0 0; width: 250px; z-index: 20; transform: translateX(-100%); transition: transform .2s; }
  .side.open { transform: none; }
  .btn.menu-toggle { display: inline-flex; }
  .topbar, .content { padding-left: 16px; padding-right: 16px; }
  .grid-2 { grid-template-columns: 1fr; }
  .hide-sm { display: none; }
  .bars .b { grid-template-columns: 100px 1fr 40px; }
}
