@font-face { font-family: "Hind Siliguri"; font-weight: 400; font-display: swap; src: url(fonts/hind-bengali-400.woff2) format("woff2"); unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0-1CF9, U+200C-200D, U+20B9, U+25CC, U+A8F1; }
@font-face { font-family: "Hind Siliguri"; font-weight: 600; font-display: swap; src: url(fonts/hind-bengali-600.woff2) format("woff2"); unicode-range: U+0951-0952, U+0964-0965, U+0980-09FE, U+1CD0-1CF9, U+200C-200D, U+20B9, U+25CC, U+A8F1; }
@font-face { font-family: "Hind Siliguri"; font-weight: 400; font-display: swap; src: url(fonts/hind-latin-400.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }
@font-face { font-family: "Hind Siliguri"; font-weight: 600; font-display: swap; src: url(fonts/hind-latin-600.woff2) format("woff2"); unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD; }

:root {
  --bg: #f3f5f9; --surface: #ffffff; --ink: #172036; --muted: #637089; --line: #e1e6ef;
  --brand: #0f766e; --brand-ink: #ffffff; --brand-soft: #e2f3f1; --navy: #111a33;
  --danger: #c0392b; --danger-soft: #fdecea; --warn-soft: #fff6e0; --ok-soft: #e5f6ec;
  --radius: 14px; --shadow: 0 1px 2px rgba(17,26,51,.06), 0 4px 16px rgba(17,26,51,.06);
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0d1322; --surface: #151d31; --ink: #e8ecf5; --muted: #98a3bb; --line: #26304a;
    --brand: #2bb3a3; --brand-ink: #06221f; --brand-soft: #123532; --navy: #0a1020;
    --danger: #f07467; --danger-soft: #3a1c1c; --warn-soft: #3a3016; --ok-soft: #13301f;
    --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: "Hind Siliguri", system-ui, sans-serif; background: var(--bg); color: var(--ink); font-size: 16px; line-height: 1.55; min-height: 100vh; display: flex; flex-direction: column; }
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 1.35rem; margin: 0 0 .35rem; }
main { width: 100%; max-width: 1180px; margin: 0 auto; padding: 20px 16px 40px; flex: 1; }
footer { text-align: center; color: var(--muted); font-size: .85rem; padding: 16px; }
.muted { color: var(--muted); } .small { font-size: .88rem; }

/* top bar */
.bar { background: var(--navy); color: #fff; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; color: #fff; font-size: 1.1rem; }
.brand:hover { text-decoration: none; }
.brand svg { width: 26px; height: 26px; fill: #2bb3a3; }
.brand svg .stroke { fill: none; stroke: #2bb3a3; stroke-width: 2; }
.brand b { color: #2bb3a3; }
.topnav { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.topnav a, .linkbtn { color: #d6dcea; padding: 6px 10px; border-radius: 8px; font: inherit; font-size: .95rem; }
.topnav a:hover, .linkbtn:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.linkbtn { background: none; border: 0; cursor: pointer; }
form.inline { display: inline; }

/* cards & forms */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); margin-bottom: 18px; }
.card.narrow { max-width: 460px; }
.auth { max-width: 400px; margin: 40px auto; text-align: center; }
.auth > svg { width: 48px; height: 48px; fill: var(--brand); margin-bottom: 4px; }
.auth > svg .stroke { fill: none; stroke: var(--brand); stroke-width: 2; }
.auth form { text-align: left; margin-top: 14px; }
label { display: block; font-weight: 600; font-size: .92rem; margin-bottom: 12px; }
input[type=text], input:not([type]), input[type=password], input[type=number] {
  display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink); font: inherit; font-weight: 400;
}
input:focus { outline: 2px solid var(--brand); outline-offset: 1px; border-color: transparent; }
label.check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--brand); }
.btn.primary { background: var(--brand); color: var(--brand-ink); border-color: var(--brand); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.wide { width: 100%; }
.flash { padding: 10px 14px; border-radius: 10px; margin-bottom: 10px; font-size: .95rem; background: var(--ok-soft); }
.flash.error { background: var(--danger-soft); }
.flash.warn { background: var(--warn-soft); }

/* browse */
.head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.crumbs { font-size: 1.1rem; font-weight: 600; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; min-width: 0; }
.crumbs a { color: var(--ink); overflow-wrap: anywhere; }
.crumbs .sep { color: var(--muted); }
.usage { min-width: 180px; text-align: right; }
.usage small { color: var(--muted); }
progress.usage-bar { appearance: none; -webkit-appearance: none; width: 100%; height: 8px; border: 0; border-radius: 6px; background: var(--line); overflow: hidden; display: block; margin-bottom: 2px; }
progress.usage-bar::-webkit-progress-bar { background: var(--line); border-radius: 6px; }
progress.usage-bar::-webkit-progress-value { background: var(--brand); border-radius: 6px; }
progress.usage-bar::-moz-progress-bar { background: var(--brand); border-radius: 6px; }

.toolbar { display: grid; grid-template-columns: 1fr minmax(260px, 360px); gap: 12px; margin-bottom: 18px; }
.upload, .mkdir { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.mkdir input { margin: 0; flex: 1; min-width: 140px; }
.drop { flex: 1; min-width: 200px; margin: 0; border: 2px dashed var(--line); border-radius: 10px; padding: 12px 14px; cursor: pointer; display: flex; flex-direction: column; font-weight: 400; transition: border-color .15s, background .15s; }
.drop:hover, .drop.over { border-color: var(--brand); background: var(--brand-soft); }
.drop input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.drop-text b { color: var(--brand); }
.progress { width: 100%; height: 6px; background: var(--line); border-radius: 4px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--brand); transition: width .2s; }

.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 14px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.tile-main { display: flex; flex-direction: column; color: var(--ink); padding: 12px 12px 6px; flex: 1; min-width: 0; }
.tile-main:hover { text-decoration: none; background: var(--brand-soft); }
.tile.folder .tile-main svg { width: 54px; height: 54px; fill: #e5a823; }
.thumb { height: 120px; border-radius: 8px; background: var(--bg); display: flex; align-items: center; justify-content: center; overflow: hidden; margin-bottom: 8px; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb.pdf svg { width: 56px; height: 56px; fill: #d64545; }
.thumb.pdf svg .fold { fill: none; stroke: #fff; stroke-width: 1.2; opacity: .7; }
.thumb.pdf svg text { fill: #fff; font: 700 5.5px system-ui, sans-serif; }
.name { font-weight: 600; font-size: .95rem; overflow-wrap: anywhere; line-height: 1.35; }
.meta { color: var(--muted); font-size: .8rem; }
.tile-actions { display: flex; flex-wrap: wrap; gap: 2px; padding: 6px 8px 8px; border-top: 1px solid var(--line); }
.tile-actions form { display: contents; }
.iconbtn { background: none; border: 0; padding: 4px 8px; border-radius: 6px; font: inherit; font-size: .82rem; color: var(--muted); cursor: pointer; }
.iconbtn:hover { background: var(--bg); color: var(--ink); text-decoration: none; }
.iconbtn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.empty { grid-column: 1 / -1; text-align: center; color: var(--muted); padding: 40px 10px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--radius); }

/* admin */
.grid-form { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 0 14px; align-items: end; }
.grid-form .btn { margin-bottom: 12px; }
.tablewrap { overflow-x: auto; }
table.users { width: 100%; border-collapse: collapse; font-size: .92rem; }
table.users th, table.users td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
table.users th { color: var(--muted); font-weight: 600; }
td.actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.inline-form { display: inline-flex; align-items: center; gap: 4px; }
.inline-form input { margin: 0; width: auto; padding: 5px 8px; display: inline-block; }
.inline-form input[type=number] { width: 90px; }
.inline-form input[type=password] { width: 150px; }
.pill { display: inline-block; font-size: .75rem; padding: 1px 8px; border-radius: 20px; background: var(--bg); color: var(--muted); }
.pill.on { background: var(--ok-soft); color: #1e7a45; } .pill.off { background: var(--danger-soft); color: var(--danger); } .pill.admin { background: var(--brand-soft); color: var(--brand); }

@media (max-width: 720px) {
  .toolbar { grid-template-columns: 1fr; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
  .usage { width: 100%; text-align: left; }
  .thumb { height: 100px; }
}
