/* ISharePrivate — modern dark UI. No external fonts/assets (strict CSP). */
:root {
  --bg: #0b0e14;
  --bg-2: #111726;
  --panel: #151c2c;
  --panel-2: #1b2438;
  --border: #25304a;
  --text: #e6ebf5;
  --muted: #93a0bd;
  --accent: #5b8cff;
  --accent-2: #7c5cff;
  --good: #2fbf71;
  --warn: #f5a623;
  --bad: #ff5c6c;
  --radius: 12px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: radial-gradient(1200px 800px at 80% -10%, #16203a 0%, var(--bg) 55%);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
}

.noscript { padding: 20px; background: var(--bad); color: #fff; text-align: center; }
.boot { padding: 80px; text-align: center; color: var(--muted); }

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

/* ---------- layout ---------- */
.app { min-height: 100vh; }

.center-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}

.card {
  background: linear-gradient(180deg, var(--panel) 0%, var(--bg-2) 100%);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 28px;
}

.auth-card { width: 100%; max-width: 440px; }
.auth-card.wide { max-width: 560px; }

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 6px;
}
.brand .logo {
  width: 38px; height: 38px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid; place-items: center; font-weight: 800; color: #fff;
}
.brand h1 { font-size: 20px; margin: 0; letter-spacing: 0.2px; }
.subtitle { color: var(--muted); margin: 2px 0 22px; font-size: 13px; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 12px 20px;
  background: rgba(11, 14, 20, 0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.topbar .brand { margin: 0; }
.topbar .brand h1 { font-size: 17px; }
.spacer { flex: 1; }
.userchip { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 13px; }

.container { max-width: 1180px; margin: 0 auto; padding: 22px 20px 60px; }

/* ---------- nav tabs ---------- */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 20px; }
.tab {
  padding: 8px 14px; border-radius: 9px; cursor: pointer;
  color: var(--muted); border: 1px solid transparent; background: transparent;
  font-size: 14px;
}
.tab:hover { color: var(--text); background: var(--panel); }
.tab.active { color: #fff; background: var(--panel-2); border-color: var(--border); }

/* ---------- forms ---------- */
label { display: block; font-size: 13px; color: var(--muted); margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; padding: 11px 12px; border-radius: 9px;
  background: var(--bg-2); border: 1px solid var(--border); color: var(--text);
  font-size: 14px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.15); }
textarea { resize: vertical; min-height: 64px; font-family: inherit; }
.hint { font-size: 12px; color: var(--muted); margin-top: 6px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 180px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 16px; border-radius: 9px; cursor: pointer;
  border: 1px solid var(--border); background: var(--panel-2); color: var(--text);
  font-size: 14px; font-weight: 600; transition: transform .04s ease, background .15s ease;
}
.btn:hover { background: #222d46; }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn.primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border: none; color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: #2a1620; border-color: #51212e; color: var(--bad); }
.btn.danger:hover { background: #3a1c29; }
.btn.warn { background: #2a2416; border-color: #514321; color: var(--warn); }
.btn.warn:hover { background: #3a3120; }
.mono-area { font-family: ui-monospace, SFMono-Regular, monospace; font-size: 12px; min-height: 110px; }
.status-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 12px 0; }
.subcard { border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin: 14px 0; background: rgba(255,255,255,.02); }
.subcard h3, .section > h3 { margin: 0 0 8px; font-size: 15px; }
.acme-status { margin: 10px 0; min-height: 20px; }
.acme-msg { color: var(--muted); font-size: 13px; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 12.5px; }
.btn.block { width: 100%; }
.btn-row { display: flex; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

/* ---------- badges ---------- */
.badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700;
  background: var(--panel-2); border: 1px solid var(--border); color: var(--muted);
}
.badge.admin { color: #fff; background: linear-gradient(135deg, var(--accent-2), var(--accent)); border: none; }
.badge.good { color: var(--good); border-color: #1e4a37; }
.badge.warn { color: var(--warn); border-color: #4a3a1e; }
.badge.bad { color: var(--bad); border-color: #4a1e26; }
.badge.lock::before { content: "🔒"; }
.badge.shared::before { content: "👥"; }
.badge.private::before { content: "🗄"; }

/* ---------- grids / cards ---------- */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.vault-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px; cursor: pointer; transition: border-color .15s ease, transform .05s ease;
}
.vault-card:hover { border-color: var(--accent); transform: translateY(-2px); }
.vault-card h3 { margin: 0 0 8px; font-size: 16px; display: flex; align-items: center; gap: 8px; }
.vault-card .meta { color: var(--muted); font-size: 12.5px; display: flex; gap: 10px; flex-wrap: wrap; }

.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); margin-bottom: 22px; }
.stat { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat .n { font-size: 26px; font-weight: 800; }
.stat .l { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

/* ---------- file grid ---------- */
.files { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.file {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden; display: flex; flex-direction: column;
}
.file .thumb {
  height: 130px; background: var(--bg-2); display: grid; place-items: center;
  overflow: hidden; color: var(--muted); font-size: 34px;
}
.file .thumb img, .file .thumb video { width: 100%; height: 100%; object-fit: cover; }
.file .body { padding: 10px 12px; }
.file .name { font-size: 13px; font-weight: 600; word-break: break-word; }
.file .sub { color: var(--muted); font-size: 11.5px; margin-top: 3px; }
.file .acts { display: flex; gap: 6px; padding: 0 10px 10px; flex-wrap: wrap; }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { text-align: left; padding: 11px 13px; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { color: var(--muted); font-weight: 600; background: var(--bg-2); position: sticky; top: 0; }
tr:last-child td { border-bottom: none; }
td.wrap, th.wrap { white-space: normal; }
.mono { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12px; }

/* ---------- section ---------- */
.section { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; margin-bottom: 20px; }
.section h2 { margin: 0 0 4px; font-size: 16px; }
.section .desc { color: var(--muted); font-size: 13px; margin-bottom: 14px; }
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.section-head h2 { margin: 0; }

/* ---------- recovery / callout ---------- */
.callout { border-radius: var(--radius); padding: 16px; font-size: 13.5px; border: 1px solid var(--border); }
.callout.warn { background: #2a230f; border-color: #4a3a1e; color: #ffd98a; }
.callout.bad { background: #2a1620; border-color: #51212e; color: #ffb3bc; }
.callout.good { background: #0f2a1d; border-color: #1e4a37; color: #9be8c0; }
.secret {
  font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 15px;
  background: var(--bg); border: 1px dashed var(--accent); border-radius: 9px;
  padding: 14px; margin: 12px 0; word-break: break-all; user-select: all;
}

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  background: var(--panel-2); border: 1px solid var(--border); border-left: 4px solid var(--accent);
  padding: 12px 16px; border-radius: 10px; box-shadow: var(--shadow); max-width: 360px; font-size: 13.5px;
  animation: slidein .18s ease;
}
.toast.error { border-left-color: var(--bad); }
.toast.success { border-left-color: var(--good); }
@keyframes slidein { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- modal ---------- */
.modal-bg {
  position: fixed; inset: 0; background: rgba(3, 6, 12, 0.7); backdrop-filter: blur(3px);
  display: grid; place-items: center; z-index: 90; padding: 20px;
}
.modal { width: 100%; max-width: 520px; max-height: 88vh; overflow: auto; }
.modal h2 { margin: 0 0 6px; font-size: 18px; }

/* ---------- misc ---------- */
.empty { text-align: center; color: var(--muted); padding: 50px 20px; }
.checklist { max-height: 220px; overflow: auto; border: 1px solid var(--border); border-radius: 9px; padding: 8px; }
.checklist label { display: flex; align-items: center; gap: 8px; margin: 0; padding: 6px; color: var(--text); cursor: pointer; }
.checklist input { width: auto; }
.inline-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.inline-form > div { flex: 1; min-width: 140px; }
.inline-form label { margin-top: 0; }
.divider { height: 1px; background: var(--border); margin: 18px 0; }
.crumb { display: flex; align-items: center; gap: 8px; margin-bottom: 16px; color: var(--muted); font-size: 14px; }
.crumb .btn { padding: 5px 10px; }
.dropzone { border: 2px dashed var(--border); border-radius: var(--radius); padding: 26px; text-align: center; color: var(--muted); transition: border-color .15s; }
.dropzone.drag { border-color: var(--accent); color: var(--text); background: var(--panel); }
.pwbar { height: 6px; border-radius: 4px; background: var(--bg); overflow: hidden; margin-top: 8px; }
.pwbar > div { height: 100%; width: 0; transition: width .2s, background .2s; }
@media (max-width: 640px) { .container { padding: 16px 12px 50px; } .card { padding: 20px; } }

/* ---------- anti-capture ---------- */
@media print { body { display: none !important; } }
.anti-capture img, .anti-capture video, .anti-capture .file, .anti-capture .gcell {
  -webkit-user-drag: none; -webkit-touch-callout: none; user-select: none;
}
body.ac-hidden #app, body.ac-hidden #toasts { filter: blur(40px) brightness(.4); transition: filter .08s; }
/* A near-opaque veil with its own backdrop blur. This sits above every content
   layer (app, modal/#modal-root z-90, toasts z-100), so it
   hides AND blurs whatever is on screen — including the media-preview modal —
   without applying `filter` to those containers (which would break the modal's
   position:fixed). The opaque background is the guarantee; the backdrop-filter
   is defence-in-depth for the sliver that shows through. */
body.ac-hidden::after {
  content: "Content hidden while the window is not focused";
  position: fixed; inset: 0; display: grid; place-items: center;
  color: #93a0bd; background: rgba(5,7,12,.985);
  -webkit-backdrop-filter: blur(60px) saturate(0); backdrop-filter: blur(60px) saturate(0);
  z-index: 600; text-align: center; padding: 20px; font-size: 15px;
}
body.devtools-open #app, body.devtools-open #toasts { filter: blur(40px) brightness(.4); pointer-events: none; }
body.devtools-open::after {
  content: "Developer tools detected — content hidden";
  position: fixed; inset: 0; display: grid; place-items: center;
  color: #ff5c6c; background: rgba(5,7,12,.985);
  -webkit-backdrop-filter: blur(60px) saturate(0); backdrop-filter: blur(60px) saturate(0);
  z-index: 99998; font-size: 18px; text-align: center; padding: 20px;
}
.blackout { position: fixed; inset: 0; background: #000; z-index: 99999; }
/* Forensic watermark — confined to the previewed media, not the whole page. */
.wm-layer {
  position: absolute; inset: 0; pointer-events: none; z-index: 5;
  display: flex; flex-wrap: wrap; align-content: flex-start; gap: 34px 22px;
  transform: rotate(-26deg) scale(1.4); transform-origin: center;
  opacity: .16; overflow: hidden; user-select: none;
}
.wm-layer .wm-t { color: #e6ecff; font-family: ui-monospace, monospace; font-size: 12px; white-space: nowrap; text-shadow: 0 1px 2px rgba(0,0,0,.5); }

/* ---------- media preview ---------- */
.preview-wrap { position: relative; overflow: hidden; }
.preview-media { max-width: 100%; max-height: 72vh; border-radius: 8px; display: block; margin: 0 auto; }
.preview-audio { width: 100%; }
.preview-pdf { width: 100%; height: 72vh; border: 0; border-radius: 8px; background: #fff; }
.card.preview-card { max-width: 820px; }

/* ---------- gallery ---------- */
.section-head select { width: auto; min-width: 180px; }
.gallery { display: grid; gap: 12px; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); }
.gcell { background: var(--panel); border: 1px solid var(--border); border-radius: 10px; overflow: hidden; cursor: pointer; }
.gcell:hover { border-color: var(--accent); }
.gcell img, .gcell video { width: 100%; height: 140px; object-fit: cover; display: block; background: #0b0e14; }
.gcell .thumb { height: 140px; display: grid; place-items: center; font-size: 34px; color: var(--muted); }
.gcap { padding: 7px 9px; font-size: 12px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
.gcap .gname { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.gcap .gshare { flex: 0 0 auto; padding: 3px 9px; font-size: 11px; }

/* ---------- danger zone ---------- */
.danger-zone { border-color: #51212e; }
.danger-zone h2 { color: var(--bad); }
pre.out { white-space: pre-wrap; word-break: break-word; max-height: 240px; overflow: auto;
  background: var(--bg); padding: 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 12px; }
