/* PACOM File Portal styles, matched to the Controller License Portal.
   Brand: navy #13263f, PACOM blue #1a9bd7 */
:root {
  --brand: #1a9bd7;
  --brand-dark: #1483bb;
  --brand-soft: #eaf6fc;
  --navy: #13263f;
  --navy-700: #1c3557;
  --nav-bg: #13263f;
  --bg: #f4f6fa;
  --card: #ffffff;
  --text: #1f2933;
  --muted: #64748b;
  --line: #e3e8ef;
  --ok: #0f8a52;
  --ok-soft: #e6f6ee;
  --warn: #b7791f;
  --warn-soft: #fdf6e3;
  --err: #c0392b;
  --err-soft: #fdecea;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(16, 32, 58, .08), 0 6px 20px rgba(16, 32, 58, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body { font: 15px/1.5 var(--font); color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--navy); line-height: 1.25; }
h1 { font-size: 1.5rem; margin: 0 0 .25rem; font-weight: 700; display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
h2 { font-size: 1.1rem; margin: 0 0 12px; font-weight: 700; }
.h-sub { font-size: 1rem; margin: .8rem 0 .3rem; }
p { margin: 0 0 12px; }
hr { border: 0; border-top: 1px solid var(--line); margin: 1.1rem 0; }
code, .mono { font-family: var(--mono); font-size: .86em; }
pre { font-family: var(--mono); font-size: 12px; white-space: pre-wrap; background: var(--bg); padding: 8px; border-radius: 6px; margin: 6px 0 0; max-width: 520px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.center { text-align: center; }
.hidden, [hidden] { display: none !important; }
.break { word-break: break-all; }
.nowrap { white-space: nowrap; }
.ellipsis { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- top bar (same as the License Portal) ---------- */
.topbar { background: var(--navy); color: #fff; box-shadow: var(--shadow); position: sticky; top: 0; z-index: 20; }
.topbar .inner { max-width: 1240px; margin: 0 auto; display: flex; align-items: center; gap: 1.25rem; padding: .6rem 1rem; min-height: 52px; }
.topbar img.logo { height: 30px; display: block; }
.topbar .brand { font-weight: 600; letter-spacing: .02em; white-space: nowrap; color: #fff; }
.topbar nav { display: flex; gap: .25rem; margin-left: auto; align-items: center; flex-wrap: wrap; }
.topbar nav > a, .topbar nav summary { color: #dce5f0; background: transparent; border: 0; font: inherit; padding: .45rem .7rem; border-radius: 7px; cursor: pointer; white-space: nowrap; }
.topbar nav > a:hover, .topbar nav summary:hover { background: var(--navy-700); color: #fff; text-decoration: none; }
.topbar nav > a.active, .topbar .nav-menu.active > summary { background: var(--brand); color: #fff; }
.topbar details { position: relative; }
.topbar details > summary { list-style: none; display: inline-flex; align-items: center; gap: .45rem; user-select: none; }
.topbar details > summary::-webkit-details-marker { display: none; }
.topbar details[open] > summary { background: var(--navy-700); color: #fff; }
.topbar .caret { font-size: .7rem; color: #9fb3cc; }
.topbar .count { background: #e0a106; color: #13263f; border-radius: 999px; font-size: .72rem; font-weight: 700; padding: 0 .4rem; }
.topbar .user-menu { margin-left: .4rem; padding-left: .6rem; border-left: 1px solid #30486a; }
.topbar .who-name { font-size: .9rem; font-weight: 600; }
.topbar .who-role { font-size: .7rem; text-transform: uppercase; letter-spacing: .04em; color: #9fb3cc; background: #20365a; padding: .08rem .4rem; border-radius: 999px; }
.user-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: #fff; border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 12px 32px rgba(19, 38, 63, .22); padding: .35rem; z-index: 40; }
.user-pop .user-head { padding: .5rem .6rem .55rem; }
.user-pop .um-name { font-weight: 700; color: var(--text); }
.user-pop .um-sub { word-break: break-all; }
.user-pop form { margin: 0; }
.user-pop .um-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; background: none; border: 0; font: inherit; color: var(--text); padding: .55rem .6rem; border-radius: 7px; cursor: pointer; text-decoration: none; }
.user-pop .um-item:hover { background: #f1f5f9; text-decoration: none; }
.user-pop .sep { height: 1px; background: var(--line); margin: .3rem .2rem; }
.badge { display: inline-block; padding: .12rem .5rem; border-radius: 999px; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.badge.pending { background: var(--warn-soft); color: var(--warn); }

.main { max-width: 1240px; margin: 1.5rem auto; padding: 0 1rem; min-width: 0; }
.main.narrow { max-width: 620px; }
footer.foot { max-width: 1240px; margin: 2rem auto; padding: 1rem; color: var(--muted); font-size: .8rem; text-align: center; }

/* ---------- sign in pages with hero ---------- */
.auth { min-height: 100vh; display: grid; grid-template-columns: 1.1fr .9fr; }
.auth .hero { background: linear-gradient(180deg, rgba(19, 38, 63, .78), rgba(19, 38, 63, .92)), url('/static/img/hero.jpg') center / cover;
  color: #fff; display: flex; flex-direction: column; justify-content: center; padding: 3rem; }
.auth .hero img { height: 42px; align-self: flex-start; margin-bottom: 2rem; }
.auth .hero h1 { color: #fff; font-size: 2rem; max-width: 22ch; }
.auth .hero p { color: #b9cae0; max-width: 40ch; }
.auth .panel { display: flex; align-items: center; justify-content: center; padding: 2rem; background: #fff; }
.auth .panel .box { width: 100%; max-width: 380px; }
.auth .auth-logo { display: none; height: 34px; margin-bottom: 1.5rem; }
.auth label { display: block; font-weight: 600; font-size: .86rem; margin: .75rem 0 .3rem; color: var(--navy-700); }
.help { color: var(--muted); font-size: .8rem; margin-top: .25rem; }
.row { display: flex; gap: 1rem; flex-wrap: wrap; }
.row > div { flex: 1; min-width: 150px; }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth .hero { display: none; }
  .auth .auth-logo { display: block; }
}

/* ---------- account ---------- */
.card form:not(.form) > label { display: block; font-weight: 600; font-size: .86rem; margin: .75rem 0 .3rem; color: var(--navy-700); }
.steps { line-height: 1.9; padding-left: 1.2rem; }
.mfa-setup { display: flex; gap: 1.5rem; flex-wrap: wrap; align-items: center; margin: .5rem 0 1rem; }
.mfa-setup img { border: 1px solid var(--line); border-radius: 10px; }
.setup-key { font-size: 1rem; word-break: break-all; max-width: 260px; }
.code-input { max-width: 200px; }

/* ---------- idle warning ---------- */
.idle-warn { position: fixed; inset: 0; background: rgba(19, 38, 63, .55); z-index: 999; display: flex; align-items: center; justify-content: center; }
.idle-box { background: #fff; border-radius: 12px; max-width: 380px; padding: 1.5rem; box-shadow: 0 10px 40px rgba(0, 0, 0, .3); text-align: center; }
.idle-box h2 { margin: 0 0 .5rem; }
.center-row { justify-content: center; }

/* ---------- public pages (share and upload links) ---------- */
body.public { min-height: 100vh; display: flex; flex-direction: column; }
.public-main { flex: 1; padding: 40px 16px; display: flex; flex-direction: column; align-items: center; }
.public-main > .flash { width: 100%; max-width: 620px; }

/* ---------- page parts ---------- */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 6px; font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.crumbs .sep { color: #b0b8c8; font-weight: 400; }
.crumbs span:last-child { color: var(--text); }
.page-head h1 + .muted, .page-head .crumbs + .muted { margin: 0; }
.section-title { margin: 28px 0 10px; font-size: 15px; }
.small-title { margin-top: 24px; font-size: 13.5px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; margin-bottom: 18px; }
.card.flush { padding: 0; overflow-x: auto; }
.card.narrow { width: 100%; max-width: 420px; }
.card.narrow-left { max-width: 680px; }
.card.highlight { border-color: #bcd4ef; background: #f6fbfe; }
.card.empty { text-align: center; padding: 48px 22px; }
.upload-card { width: 100%; max-width: 620px; }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.cols > .card { margin-bottom: 0; }
.note { background: var(--brand-soft); border-radius: 8px; padding: 10px 12px; white-space: pre-wrap; }

/* ---------- forms ---------- */
.form { display: flex; flex-direction: column; gap: 14px; }
.form label { display: flex; flex-direction: column; gap: 5px; font-weight: 550; font-size: 13px; }
.form label .muted { font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input:not([type]), select, textarea {
  font: inherit; font-weight: 400; color: var(--text); background: #fff; border: 1px solid #d0d5dd; border-radius: 7px; padding: 8px 10px; width: 100%; min-width: 0;
}
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--brand); outline-offset: 0; border-color: var(--brand); }
input[readonly] { background: var(--bg); font-family: var(--mono); font-size: 12.5px; }
.form label.check, .form label.radio { flex-direction: row; align-items: center; gap: 8px; font-weight: 450; }
.check input, .radio input { width: 16px; height: 16px; accent-color: var(--brand); margin: 0; }
.seg-field { border: 0; padding: 0; margin: 0; display: block; }
.seg-field legend { font-weight: 550; font-size: 13px; padding: 0; margin-bottom: 8px; float: left; width: 100%; }
.seg-field label.radio { display: inline-flex !important; margin-right: 22px; }
.seg-field::after { content: ''; display: block; clear: both; }
.form [data-storage-panel], .form [data-auth-panel] { display: flex; flex-direction: column; gap: 14px; }
.form .hint + .hint { margin-top: -8px; }
.hint { color: var(--muted); font-size: 12.5px; margin: -6px 0 0; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.grid-host { display: grid; grid-template-columns: 1fr 110px; gap: 14px; }
.form-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
.inline-fields { display: flex; align-items: flex-end; gap: 8px; }
.inline-fields label { width: 120px; }
.inline-fields .unit { padding-bottom: 9px; color: var(--muted); }
.narrow-form { max-width: 300px; margin: 0 auto; }
.copy-row { display: flex; gap: 8px; }
.search { display: flex; gap: 8px; }
.search input { width: 260px; }
form.inline { display: inline; }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; font: inherit; font-weight: 550; padding: 8px 14px; border-radius: 7px; border: 1px solid #d0d5dd; background: #fff; color: var(--text); cursor: pointer; white-space: nowrap; line-height: 1.2; }
.btn:hover { background: #f9fafb; text-decoration: none; }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { border-color: transparent; background: transparent; color: var(--brand-dark); }
.btn-ghost:hover { background: var(--brand-soft); }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger:hover { background: #a93226; }
.btn-danger-ghost { border-color: transparent; background: transparent; color: var(--err); }
.btn-danger-ghost:hover { background: var(--err-soft); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 12px 28px; font-size: 15px; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }

.seg { display: inline-flex; background: #e9edf3; padding: 3px; border-radius: 8px; }
.seg a { padding: 5px 12px; border-radius: 6px; color: var(--muted); font-weight: 550; font-size: 13px; }
.seg a:hover { text-decoration: none; color: var(--text); }
.seg a.on { background: #fff; color: var(--text); box-shadow: var(--shadow); }

/* ---------- tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fafbfc; white-space: nowrap; }
.table th a { color: inherit; }
.table td { padding: 10px 16px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tr:last-child td { border-bottom: 0; }
.table tbody tr:hover { background: #fafbfd; }
.table .num { text-align: right; white-space: nowrap; }
.table .actions { text-align: right; white-space: nowrap; width: 1%; }
.table .actions > * + * { margin-left: 4px; }
.empty-row { text-align: center; color: var(--muted); padding: 36px 16px !important; }
.fname { display: inline-flex; align-items: center; gap: 10px; color: var(--text); font-weight: 500; word-break: break-word; }
a.fname:hover { color: var(--brand); }
.is-deleted td { color: #98a2b3; }
.is-deleted .fname { text-decoration: line-through; }

/* ---------- pills, dots ---------- */
.pill { display: inline-block; font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: #eef0f4; color: #475467; text-transform: capitalize; vertical-align: middle; }
.pill-ok { background: var(--ok-soft); color: var(--ok); }
.pill-warn { background: var(--warn-soft); color: var(--warn); }
.pill-err { background: var(--err-soft); color: var(--err); }
.pill-run { background: var(--brand-soft); color: var(--brand); }
.pill-muted { background: #eef0f4; color: #667085; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }
.dot-run { background: var(--brand); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .3; } }

.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-weight: 500; border: 1px solid transparent; }
.flash.success, .flash-ok { background: var(--ok-soft); color: var(--ok); border-color: #bfe6cf; }
.flash.error, .flash-error { background: var(--err-soft); color: var(--err); border-color: #f3c7c1; }
.flash.warn { background: var(--warn-soft); color: var(--warn); border-color: #f0e0b0; }

/* ---------- tiles, stats, facts ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.tile { display: flex; gap: 14px; align-items: center; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); color: var(--text); }
.tile:hover { border-color: #bcd4ef; text-decoration: none; }
.tile-body { display: flex; flex-direction: column; min-width: 0; }
.tile-body strong { font-size: 15px; }
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; font-weight: 600; }
.stat-value { font-size: 22px; font-weight: 650; }
.stat-value.small-value { font-size: 16px; padding-top: 5px; }
.facts { display: grid; gap: 8px; margin: 14px 0 0; }
.facts div { display: grid; grid-template-columns: 130px 1fr; gap: 12px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }

.rules { list-style: none; padding: 0; margin: 0 0 16px; }
.rules li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.rules li > span { display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.rule-form { background: var(--bg); border-radius: 8px; padding: 14px; }

/* ---------- sync progress ---------- */
.progress-card { padding: 16px 22px; }
.progress-head { display: flex; justify-content: space-between; margin-bottom: 8px; }
.bar { height: 8px; background: #e6ebf3; border-radius: 99px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .3s; }
.progress-card .mono { margin-top: 6px; }

/* ---------- upload page ---------- */
.dropzone { border: 2px dashed #c3cbd8; border-radius: 10px; padding: 32px 16px; text-align: center; cursor: pointer; display: flex !important; flex-direction: column; align-items: center; gap: 6px !important; background: #fbfcfe; transition: border-color .15s, background .15s; }
.dropzone:hover, .dropzone.over { border-color: var(--brand); background: var(--brand-soft); }
.dropzone input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.dropzone strong { font-size: 15px; }
.dropzone small { font-weight: 400; }
.queue { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.queue:empty { display: none; }
.queue li { border: 1px solid var(--line); border-radius: 8px; padding: 9px 12px; display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; align-items: center; }
.queue .q-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.queue .q-meta { font-size: 12px; color: var(--muted); text-align: right; }
.queue .bar { grid-column: 1 / -1; height: 5px; }
.queue li.done .bar span { background: var(--ok); }
.queue li.fail { border-color: #f5c6c1; background: var(--err-soft); }
.queue li.fail .q-meta { color: var(--err); }
.queue .q-remove { background: none; border: 0; color: var(--muted); cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px; }
.received { list-style: none; padding: 0; margin: 0; }
.received li { display: flex; align-items: center; gap: 8px; padding: 5px 0; }

/* ---------- dialog ---------- */
.dialog { border: 0; border-radius: 12px; padding: 24px; width: min(480px, calc(100vw - 32px)); box-shadow: 0 20px 50px rgba(16, 24, 40, .25); }
.dialog::backdrop { background: rgba(15, 30, 61, .45); }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }

/* ---------- icons (mask images so they take the text color) ---------- */
.ico, .ico-lg, .ico-xl { display: inline-block; flex: none; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; }
.ico { width: 18px; height: 18px; }
.nav .ico { opacity: .85; }
.fname .ico { color: #667085; }
.fname .ico-folder { color: #d99a1c; }
.fname .ico-zip { color: #7a5af8; }
.fname .ico-pdf { color: #d92d20; }
.fname .ico-bin { color: #0e9384; }
.fname .ico-img { color: #2e90fa; }
.ico-lg { width: 34px; height: 34px; }
.tile .ico-folder { color: #d99a1c; }
.ico-xl { width: 46px; height: 46px; color: var(--brand); margin-bottom: 10px; }
.received .ico { color: var(--ok); }

@media (max-width: 960px) {
  .cols, .grid-3 { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 760px) {
  .topbar .inner { flex-wrap: wrap; gap: .5rem; }
  .topbar nav { margin-left: 0; width: 100%; }
  .topbar .user-menu { margin-left: auto; border-left: 0; }
  .topbar .who-name { max-width: 110px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .hide-sm { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .search input { width: 100%; }
  .search { width: 100%; }
  .facts div { grid-template-columns: 1fr; gap: 0; }
}

/* icon shapes */
.ico-folder{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 7a2 2 0 0 1 2-2h4l2 2h8a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z'/%3E%3C/svg%3E")}
.ico-link{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.5.5l3-3a5 5 0 0 0-7-7l-1.7 1.7'/%3E%3Cpath d='M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.7-1.7'/%3E%3C/svg%3E")}
.ico-link-off{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 13a5 5 0 0 0 7.5.5l1-1M14 11a5 5 0 0 0-7.5-.5l-3 3a5 5 0 0 0 7 7l1.7-1.7M15 4.5l-1.2 1.2M18 2a5 5 0 0 1 2.5 8.5M3 3l18 18'/%3E%3C/svg%3E")}
.ico-inbox{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M22 12h-6l-2 3h-4l-2-3H2'/%3E%3Cpath d='M5.5 5h13l3.5 7v6a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2v-6z'/%3E%3C/svg%3E")}
.ico-users{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='9' cy='8' r='4'/%3E%3Cpath d='M2 21v-1a6 6 0 0 1 12 0v1M16 3.5a4 4 0 0 1 0 9M22 21v-1a6 6 0 0 0-4-5.6'/%3E%3C/svg%3E")}
.ico-server{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='7' rx='2'/%3E%3Crect x='3' y='14' width='18' height='7' rx='2'/%3E%3Cpath d='M7 6.5h.01M7 17.5h.01'/%3E%3C/svg%3E")}
.ico-list{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M8 6h13M8 12h13M8 18h13M3 6h.01M3 12h.01M3 18h.01'/%3E%3C/svg%3E")}
.ico-up{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9 14L4 9l5-5'/%3E%3Cpath d='M4 9h11a5 5 0 0 1 5 5v6'/%3E%3C/svg%3E")}
.ico-file{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5'/%3E%3C/svg%3E")}
.ico-zip{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5M10 5h1M10 8h1M10 11h1M10 14h1v3h-1z'/%3E%3C/svg%3E")}
.ico-pdf{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5M9 13h6M9 17h4'/%3E%3C/svg%3E")}
.ico-bin{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='5' width='14' height='14' rx='2'/%3E%3Cpath d='M9 9h6v6H9zM9 2v3M15 2v3M9 19v3M15 19v3M2 9h3M2 15h3M19 9h3M19 15h3'/%3E%3C/svg%3E")}
.ico-img{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='3' width='18' height='18' rx='2'/%3E%3Ccircle cx='9' cy='9' r='2'/%3E%3Cpath d='M21 15l-5-5L5 21'/%3E%3C/svg%3E")}
.ico-doc{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M14 3H7a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V8z'/%3E%3Cpath d='M14 3v5h5M9 12h6M9 16h6'/%3E%3C/svg%3E")}
.ico-check{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E")}
.ico-upload{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M17 8l-5-5-5 5M12 3v12'/%3E%3C/svg%3E")}
.ico-lock{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='4' y='11' width='16' height='10' rx='2'/%3E%3Cpath d='M8 11V7a4 4 0 0 1 8 0v4'/%3E%3C/svg%3E")}
.ico-shield{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3l8 3v6c0 5-3.5 8-8 9-4.5-1-8-4-8-9V6z'/%3E%3Cpath d='M9 12l2 2 4-4'/%3E%3C/svg%3E")}
.ico-search{--i:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='M21 21l-4.3-4.3'/%3E%3C/svg%3E")}

/* ---------- roles ---------- */
.role-list { display: flex; flex-direction: column; gap: 6px; }
.form label.role-option { align-items: flex-start; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; }
.role-option input { margin-top: 2px; }
.role-option span { display: flex; flex-direction: column; }
.add-extra summary { list-style: none; display: inline-flex; }
.add-extra summary::-webkit-details-marker { display: none; }
.add-extra[open] summary { margin-bottom: 12px; }

/* ---------- documents library ---------- */
.main.main-full { max-width: none; margin: 0; padding: 0; height: calc(100vh - 52px); overflow: hidden; display: flex; flex-direction: column; }
.body-main-full footer.foot { display: none; }
.main-full > .flash { margin: 12px 16px 0; }
.docs { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.docs-bar { display: flex; align-items: center; gap: 16px; padding: 14px 20px; border-bottom: 1px solid var(--line); background: var(--card); flex-wrap: wrap; }
.docs-bar h1 { margin: 0; font-size: 19px; }
.docs-search { flex: 1; max-width: 460px; position: relative; }
.docs-search .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: #98a2b3; width: 16px; height: 16px; }
.docs-search input { padding-left: 34px; border-radius: 999px; }
.docs-scope { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.docs-scope input { accent-color: var(--brand); }
#doc-status { margin-left: auto; }
.docs-body { flex: 1; min-height: 0; display: grid; grid-template-columns: 300px minmax(320px, 1fr) minmax(360px, 1.25fr); }
.docs-side { border-right: 1px solid var(--line); background: #fbfcfe; padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.side-title { font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; margin-top: 4px; }
.side-title-row { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
.btn-text { background: none; border: 0; color: var(--brand); font: inherit; font-size: 12px; text-transform: none; letter-spacing: 0; cursor: pointer; padding: 0; }
.type-pills { display: flex; flex-wrap: wrap; gap: 6px; }
.type-pill { display: inline-flex; align-items: center; gap: 6px; font: inherit; font-size: 12px; font-weight: 550; padding: 4px 10px; border-radius: 999px; border: 1px solid #d0d5dd; background: #fff; color: #475467; cursor: pointer; }
.type-pill .n { background: #eef0f4; border-radius: 999px; padding: 0 6px; font-size: 11px; }
.type-pill.all { border-style: dashed; }
.type-pill.on { border-color: var(--brand); background: var(--brand-soft); color: var(--brand); border-style: solid; }
.type-pill.on .n { background: #fff; }
.tree { font-size: 13px; }
.tree-row { display: flex; align-items: center; gap: 4px; padding: 4px 6px; border-radius: 6px; cursor: pointer; }
.tree-row:hover { background: #eef2f8; }
.tree-row.active { background: var(--brand-soft); color: var(--brand); font-weight: 600; }
.caret { width: 18px; height: 18px; flex: none; border: 0; background: none; color: var(--muted); font: inherit; font-weight: 700; cursor: pointer; border-radius: 4px; padding: 0; line-height: 1; }
.caret:hover { background: #dfe5ee; }
.caret.none { cursor: default; }
.caret.none:hover { background: none; }
.tree-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-count { font-size: 11px; color: var(--muted); font-weight: 400; }
.docs-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.docs-list-head { display: flex; justify-content: space-between; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); font-size: 13px; color: var(--muted); background: #fafbfc; }
.doc-items { flex: 1; overflow-y: auto; padding: 10px 12px; display: flex; flex-direction: column; gap: 6px; }
.doc-item { display: grid; grid-template-columns: auto 1fr auto; gap: 12px; align-items: center; padding: 9px 12px; border: 1px solid var(--line); border-radius: 9px; background: #fff; cursor: pointer; transition: border-color .12s, box-shadow .12s; }
.doc-item:hover { border-color: #bcd4ef; }
.doc-item:focus { outline: none; box-shadow: 0 0 0 3px rgba(26, 155, 215, .2); }
.doc-item.active { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.doc-badge { width: 40px; height: 30px; border-radius: 7px; display: grid; place-items: center; font-size: 10.5px; font-weight: 700; letter-spacing: .02em; background: #eef0f4; color: #475467; }
.b-pdf { background: #fdecea; color: #c0362c; }
.b-word { background: #e8f0fd; color: #1a56c4; }
.b-excel { background: #e3f5ee; color: #12805c; }
.b-ppt { background: #fdf1e3; color: #b25e09; }
.b-text { background: #f1f3f6; color: #475467; }
.b-image { background: #f3eefe; color: #6941c6; }
.doc-text { min-width: 0; }
.doc-name { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-path { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { text-align: right; font-size: 11.5px; color: var(--muted); white-space: nowrap; }
.docs-preview { display: flex; flex-direction: column; min-height: 0; background: #f7f8fb; }
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 16px; border-bottom: 1px solid var(--line); background: #fff; flex-wrap: wrap; }
.preview-titles { display: flex; flex-direction: column; min-width: 0; }
.preview-titles strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.preview-actions { display: flex; gap: 6px; }
.preview-body { flex: 1; min-height: 0; padding: 12px; display: flex; flex-direction: column; }
.preview-empty { flex: 1; border: 1px dashed #c3cbd8; border-radius: 10px; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; color: var(--muted); padding: 20px; }
.pv-frame { flex: 1; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.pv-image { flex: 1; min-height: 0; width: 100%; object-fit: contain; background: #fff; border: 1px solid var(--line); border-radius: 8px; }
.pv-text { flex: 1; margin: 0; max-width: none; overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 12px; font-size: 12px; line-height: 1.45; }
.pv-note { margin-top: 6px; }
@media (max-width: 1200px) { .docs-body { grid-template-columns: 250px 1fr 1fr; } }
@media (max-width: 980px) { .docs-body { grid-template-columns: 1fr 1fr; } .docs-side { display: none; } }
@media (max-width: 760px) {
  .main.main-full { height: auto; overflow: visible; }
  .docs-body { grid-template-columns: 1fr; }
  .docs-preview { display: none; }
  .docs-list { border-right: 0; }
  #doc-status { margin-left: 0; }
}

/* ---------- fixes ---------- */
.form > .btn, .form > button.btn { align-self: flex-start; }
.form > .btn-block { align-self: stretch; }
.preview-titles span { overflow-wrap: anywhere; }
.preview-head { align-items: flex-start; }
.preview-actions { flex: none; }
#doc-count { flex: 1; min-width: 0; }
.docs-list-head .muted { flex: none; max-width: 50%; text-align: right; }

.pill-plain { text-transform: none; font-family: var(--font); }
.form [data-kind-panel] > .hint { margin-top: 0; }
