:root {
  --navy: #12314f;
  --navy-2: #1a4f78;
  --sky: #d9f0ff;
  --blue: #2f95df;
  --blue-dark: #1f76b6;
  --blue-soft: #eef8ff;
  --orange: #f5a623;
  --orange-dark: #e08f0f;
  --danger: #c0392b;
  --danger-dark: #9f2d22;
  --success: #1f8f5f;
  --bg: #eef4f9;
  --bg-accent: #f8fbfe;
  --card: rgba(255,255,255,0.94);
  --card-strong: #ffffff;
  --text: #16324f;
  --muted: #5f7288;
  --border: #d9e6f2;
  --shadow: 0 14px 38px rgba(18,49,79,0.10);
  --shadow-soft: 0 8px 24px rgba(18,49,79,0.07);
  --radius: 18px;
}
* { box-sizing: border-box; }
html { min-height: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(47,149,223,0.16), transparent 24%),
    radial-gradient(circle at top right, rgba(245,166,35,0.14), transparent 22%),
    linear-gradient(180deg, #f7fbff 0%, #edf4f9 45%, #e8f0f6 100%);
}
a { color: var(--blue-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 10px; color: #102b44; }
h1 { font-size: 30px; line-height: 1.1; }
h2 { font-size: 20px; }
p { margin: 0 0 12px; color: var(--muted); }
small, .muted { color: var(--muted); }
.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  background: linear-gradient(135deg, var(--navy), var(--navy-2));
  color: white;
  display:flex;
  justify-content:space-between;
  align-items:center;
  padding: 14px 22px;
  box-shadow: 0 10px 28px rgba(18,49,79,0.25);
}
.branding { display:flex; align-items:center; gap: 14px; }
.logo {
  height: 52px;
  background: white;
  padding: 5px 12px;
  border-radius: 14px;
  box-shadow: 0 10px 18px rgba(0,0,0,.16);
}
.brand-copy { display:flex; flex-direction:column; gap: 2px; }
.brand-title { font-size: 20px; font-weight: 800; letter-spacing: .02em; }
.brand-subtitle { font-size: 12px; color: rgba(255,255,255,.82); }
.nav-links { display:flex; align-items:center; gap: 10px; flex-wrap: wrap; }
.nav-links a {
  color: white;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.08);
  border: 1px solid rgba(255,255,255,.12);
}
.nav-links a:hover { background: rgba(255,255,255,.16); text-decoration: none; }
.page { max-width: 1280px; margin: 28px auto; padding: 0 18px 34px; }
.hero {
  background: linear-gradient(135deg, rgba(18,49,79,.96), rgba(47,149,223,.88));
  color: white;
  border-radius: 28px;
  padding: 28px 30px;
  margin-bottom: 22px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.hero::after {
  content: "";
  position: absolute;
  inset: auto -30px -30px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
}
.hero h1, .hero p, .hero a, .hero .muted { color: white; }
.hero p { color: rgba(255,255,255,.84); }
.hero-meta { display:flex; gap: 14px; flex-wrap: wrap; margin-top: 14px; }
.hero-chip, .chip {
  display:inline-flex;
  align-items:center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.14);
  color: inherit;
  font-size: 13px;
  font-weight: 600;
}
.card {
  background: var(--card);
  border: 1px solid rgba(255,255,255,.55);
  backdrop-filter: blur(8px);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-soft);
}
.card.subtle { background: linear-gradient(180deg, rgba(255,255,255,.98), rgba(246,250,254,.96)); }
.card-header { display:flex; justify-content:space-between; gap: 16px; align-items:flex-start; margin-bottom: 12px; }
.narrow { max-width: 480px; margin: 50px auto; }
.narrow-wide { max-width: 860px; margin: 24px auto; }
.row { display:flex; gap: 14px; }
.row.wrap { flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.row.center { align-items: center; }
.row.start { align-items: flex-start; }
.grid.two { display:grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.grid.three { display:grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.stack { display:flex; flex-direction:column; gap: 12px; }
.mt { margin-top: 16px; }
.mb { margin-bottom: 14px; }
label { display:block; font-weight: 700; color: #14324e; }
input[type=text], input[type=password], input[type=email], textarea, select {
  width:100%;
  margin-top:7px;
  padding:12px 14px;
  border:1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  background: white;
  color: var(--text);
  transition: border-color .16s ease, box-shadow .16s ease, transform .16s ease;
}
input[type=text]:focus, input[type=password]:focus, input[type=email]:focus, textarea:focus, select:focus {
  outline: none;
  border-color: rgba(47,149,223,.75);
  box-shadow: 0 0 0 4px rgba(47,149,223,.12);
}
input[type=file] {
  width: 100%;
  margin-top: 7px;
  padding: 10px;
  border-radius: 12px;
  border: 1px dashed var(--border);
  background: #fff;
}
input[type=checkbox] { margin-right: 8px; accent-color: var(--blue); }
textarea { min-height: 100px; resize: vertical; }
.btn {
  border: none;
  border-radius: 12px;
  padding: 11px 16px;
  cursor:pointer;
  background: linear-gradient(180deg, #eff6fb, #dfebf6);
  color:#16324f;
  text-decoration:none;
  display:inline-flex;
  align-items:center;
  justify-content:center;
  gap: 8px;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(18,49,79,.07);
  transition: transform .12s ease, box-shadow .12s ease, filter .12s ease;
}
.btn:hover { transform: translateY(-1px); text-decoration:none; filter: brightness(1.01); }
.btn.primary { background: linear-gradient(135deg, var(--orange), #f6b54f); color: white; }
.btn.primary:hover { background: linear-gradient(135deg, var(--orange-dark), #f4ab35); }
.btn.secondary { background: linear-gradient(135deg, #2f95df, #4da8ea); color: white; }
.btn.danger { background: linear-gradient(135deg, var(--danger), #d24f42); color: white; }
.btn.danger:hover { background: linear-gradient(135deg, var(--danger-dark), #b83c31); }
.btn.warning { background: linear-gradient(135deg, #956200, #b87b03); color: white; }
.btn.small { padding: 8px 11px; font-size: 12px; }
.btn.full { width: 100%; }
.inline-form { display:flex; gap:8px; align-items:center; flex-wrap: wrap; }
.table-wrap { overflow-x: auto; }
table { width:100%; border-collapse: separate; border-spacing: 0 10px; margin-top: 6px; }
th, td { padding: 12px 10px; vertical-align: top; text-align:left; font-size: 14px; }
th { color: var(--muted); font-weight: 800; padding-bottom: 2px; }
tbody tr {
  background: rgba(255,255,255,.84);
  box-shadow: 0 8px 18px rgba(18,49,79,.04);
}
tbody td:first-child { border-top-left-radius: 12px; border-bottom-left-radius: 12px; }
tbody td:last-child { border-top-right-radius: 12px; border-bottom-right-radius: 12px; }
.flash-stack { display:flex; flex-direction:column; gap:10px; margin-bottom:18px; }
.flash { padding:13px 15px; border-radius:14px; border:1px solid transparent; box-shadow: var(--shadow-soft); }
.flash.success { background:#e9f8ef; color:#175c2d; border-color: #cbeed7; }
.flash.info { background:#edf6ff; color:#1f4f7a; border-color: #d9ebfd; }
.flash.warning { background:#fff6e5; color:#7a5612; border-color: #f8de99; }
.flash.danger { background:#fdecec; color:#8d2b2b; border-color: #f5c6c6; }
.checkbox-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 10px 18px; margin-top: 8px; }
.checkbox-grid label {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-accent);
  border: 1px solid var(--border);
  font-weight: 600;
}
.list { list-style:none; padding:0; margin:0; }
.list li {
  padding:10px 0;
  border-top:1px solid var(--border);
  display:flex;
  gap: 12px;
  align-items:center;
  justify-content:space-between;
  flex-wrap: wrap;
}
.breadcrumbs {
  color:var(--muted);
  margin-bottom:10px;
  font-size: 14px;
  display:flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}
.inline-details summary { list-style:none; }
.inline-details summary::-webkit-details-marker { display:none; }
.kicker { text-transform: uppercase; letter-spacing: .12em; font-size: 12px; font-weight: 800; color: var(--blue-dark); margin-bottom: 8px; }
.stat-grid { display:grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-top: 18px; }
.stat {
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.96), rgba(241,248,255,.88));
  border: 1px solid var(--border);
}
.stat .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; }
.stat .value { font-size: 24px; font-weight: 800; margin-top: 4px; color: #0f2a42; }
.form-note {
  font-size: 13px;
  color: var(--muted);
  margin-top: -4px;
}
.empty-state {
  padding: 18px;
  border-radius: 16px;
  border: 1px dashed var(--border);
  background: linear-gradient(180deg, #fcfeff, #f3f8fc);
  color: var(--muted);
}
.auth-shell { min-height: calc(100vh - 140px); display:grid; place-items:center; }
.auth-card {
  width: 100%;
  max-width: 480px;
  background: linear-gradient(180deg, rgba(255,255,255,.97), rgba(247,251,255,.95));
}
.footer-note { text-align:center; margin-top: 18px; font-size: 13px; color: var(--muted); }
@media (max-width: 1000px) {
  .grid.two, .grid.three { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  .inline-form { flex-direction:column; align-items:stretch; }
  .topbar { flex-direction: column; gap: 14px; align-items: stretch; }
  .branding { justify-content: center; }
  .nav-links { justify-content: center; }
  .page { padding: 0 14px 28px; }
  h1 { font-size: 26px; }
  .hero { padding: 22px 20px; border-radius: 22px; }
}


body { font-size: 14px; }
h1 { font-size: 26px; }
h2 { font-size: 18px; }
p { margin-bottom: 10px; }
.topbar { padding: 10px 16px; }
.logo { height: 42px; padding: 4px 10px; border-radius: 12px; }
.brand-title { font-size: 18px; }
.brand-subtitle { font-size: 11px; }
.nav-links a { padding: 8px 12px; font-size: 13px; }
.page { max-width: 1240px; margin: 18px auto; }
.hero { padding: 18px 20px; border-radius: 22px; margin-bottom: 16px; }
.hero-meta { gap: 10px; margin-top: 10px; }
.hero-chip, .chip { padding: 6px 10px; font-size: 12px; }
.card { padding: 16px; margin-bottom: 16px; border-radius: 16px; }
.compact-card .card-header { margin-bottom: 8px; }
label { font-size: 13px; }
input[type=text], input[type=password], input[type=email], textarea, select { padding: 10px 12px; border-radius: 10px; }
input[type=file] { padding: 8px; border-radius: 10px; }
textarea { min-height: 84px; }
.btn { padding: 9px 13px; border-radius: 10px; font-size: 13px; }
.btn.small { padding: 7px 10px; font-size: 12px; }
.stack { gap: 10px; }
.inline-form { gap: 6px; }
.compact-toolbar { display:flex; justify-content:flex-end; margin: 0 0 10px; }
.table-filter { max-width: 320px; background: #fff; }
.compact-table { border-spacing: 0 8px; }
.compact-table th, .compact-table td { padding: 9px 8px; font-size: 13px; }
.disclosure-card > summary { cursor: pointer; list-style: none; }
.disclosure-card > summary::-webkit-details-marker { display: none; }
.summary-toggle { margin-bottom: 0; }
.details-body { margin-top: 12px; }
.summary-pill { display:inline-flex; align-items:center; justify-content:center; min-width: 58px; padding: 6px 10px; border-radius: 999px; background: #eef4fb; color: var(--blue-dark); font-size: 12px; font-weight: 700; }
details[open] .summary-pill { background: #e6f7ec; color: var(--success); }
.toolbar + .table-wrap { margin-top: 0; }
.table-wrap table select, .table-wrap table input[type=password] { min-width: 120px; }
.auth-card { max-width: 430px; }
.checkbox-grid { gap: 8px 14px; }
.checkbox-grid label { padding: 8px 10px; font-size: 13px; }
.list li { padding: 8px 0; }
.empty-state { padding: 14px; border-radius: 14px; }
@media (max-width: 900px) {
  .page { padding: 0 10px 22px; }
  .hero { padding: 16px; border-radius: 18px; }
  .table-filter { max-width: 100%; width: 100%; }
  .compact-toolbar { justify-content: stretch; }
}


.file-manager-card { padding-top: 14px; }
.upload-inline-form {
  display: grid;
  grid-template-columns: minmax(260px, 1.4fr) minmax(220px, 1fr) auto;
  gap: 10px;
  align-items: end;
}
.upload-inline-form label { margin: 0; }
.upload-inline-form input[type=file],
.upload-inline-form input[type=text] { margin-top: 6px; }
.upload-submit { white-space: nowrap; }
.compact-disclosure > summary.btn { display: inline-flex; }
.manager-table td, .manager-table th { white-space: nowrap; }
.manager-table td:nth-child(1), .manager-table th:nth-child(1),
.manager-table td:nth-child(3), .manager-table th:nth-child(3) { white-space: normal; }
.folder-row td { background: rgba(236,245,255,.7); }
.bottom-toolbar { justify-content: flex-start; margin-top: 12px; margin-bottom: 0; }
@media (max-width: 900px) {
  .upload-inline-form { grid-template-columns: 1fr; align-items: stretch; }
  .upload-submit { width: 100%; }
}


.compact-hero {
  padding: 0.5rem 0 0.25rem;
  margin-bottom: 0.5rem;
  min-height: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
}

.compact-hero .hero-meta {
  gap: 0.45rem;
}

.branding {
  gap: 0.4rem;
}

.bottom-toolbar {
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  padding-top: 0.7rem;
}

.bottom-toolbar .table-filter {
  max-width: 360px;
}

@media (max-width: 720px) {
  .bottom-toolbar {
    align-items: stretch;
  }

  .bottom-toolbar .table-filter {
    max-width: none;
    width: 100%;
  }
}


.topbar {
  min-height: 62px;
}
.branding {
  min-width: 1px;
  flex: 1 1 auto;
}
.nav-links {
  margin-left: auto;
}
.compact-hero {
  color: var(--text);
}
.compact-hero .hero-chip {
  background: rgba(18,49,79,.10);
  color: var(--text);
  border: 1px solid rgba(18,49,79,.12);
}
.compact-hero .btn.warning.small {
  color: #fff;
}
.page-footer {
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 10px 16px 24px;
}
.footer-logo {
  display: block;
  height: 44px;
  max-width: min(92vw, 340px);
  width: auto;
  background: white;
  padding: 4px 12px;
  border-radius: 12px;
  box-shadow: 0 10px 18px rgba(0,0,0,.12);
}
@media (max-width: 900px) {
  .topbar {
    min-height: 0;
  }
  .page-footer {
    padding: 6px 12px 18px;
  }
  .footer-logo {
    height: 38px;
    max-width: 86vw;
  }
}


/* home page folder action cleanup */
.home-folder-actions {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(200px, 280px);
  align-items: start;
  gap: 12px;
}
.create-folder-block {
  width: 100%;
  min-width: 0;
}
.create-folder-block > summary.btn {
  width: fit-content;
  max-width: 100%;
}
.create-folder-form {
  width: 100%;
  max-width: none;
}
.home-folder-filter {
  width: 100%;
  max-width: 280px;
  justify-self: end;
}
@media (max-width: 900px) {
  .home-folder-actions {
    grid-template-columns: 1fr;
  }
  .home-folder-filter {
    max-width: 220px;
    justify-self: start;
  }
}
@media (max-width: 560px) {
  .home-folder-filter {
    max-width: 170px;
  }
  .create-folder-block > summary.btn {
    width: 100%;
  }
}


/* folder page tightening */
.folder-topbar {
  padding: 2px 0 0;
  margin-bottom: 8px;
}
.compact-breadcrumbs {
  margin-bottom: 2px;
  font-size: 13px;
}
.folder-topline {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}
.folder-description-inline {
  color: var(--muted);
}
.folder-owner-inline {
  color: var(--text);
  font-weight: 600;
}
.file-manager-card {
  padding-top: 10px;
}
.folder-actions-below {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.create-subfolder-block > summary.btn {
  width: fit-content;
  max-width: 100%;
}
.folder-filter-toolbar {
  justify-content: flex-start;
  margin-top: 2px;
}
.folder-filter-toolbar .table-filter {
  max-width: 260px;
}
@media (max-width: 900px) {
  .folder-filter-toolbar .table-filter {
    max-width: 100%;
    width: 100%;
  }
  .create-subfolder-block > summary.btn {
    width: 100%;
  }
}


.row-actions {
  position: relative;
}
.row-actions summary {
  list-style: none;
}
.row-actions summary::-webkit-details-marker {
  display: none;
}
.row-actions-panel {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff, #f2f7fb);
  box-shadow: 0 8px 18px rgba(18,49,79,.05);
  min-width: min(92vw, 320px);
}
.row-action-form + .row-action-form {
  margin-top: 8px;
}
.row-action-form select,
.row-action-form input[type=password] {
  min-width: min(100%, 280px);
}
@media (max-width: 900px) {
  .row-actions-panel {
    min-width: 0;
    width: 100%;
  }
}


/* folder header cleanup */
.folder-header-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px 18px;
  padding: 2px 2px 0;
  margin: 0 0 8px;
  overflow: visible;
}
.folder-breadcrumb-line {
  margin: 0;
  min-width: 0;
  flex: 1 1 auto;
  line-height: 1.35;
}
.folder-breadcrumb-line a {
  white-space: nowrap;
}
.folder-topline {
  margin: 0;
  min-width: 0;
  flex: 0 1 auto;
  justify-content: flex-end;
  white-space: nowrap;
}
.folder-description-inline {
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 44vw;
  white-space: nowrap;
}
.folder-owner-inline {
  white-space: nowrap;
}
@media (max-width: 900px) {
  .folder-header-bar {
    display: block;
    padding: 0;
  }
  .folder-breadcrumb-line {
    margin-bottom: 2px;
  }
  .folder-topline {
    justify-content: flex-start;
    white-space: normal;
  }
  .folder-description-inline {
    max-width: 100%;
    white-space: normal;
  }
}


/* stronger emphasis for primary file/folder links */
#folder-table tbody td:first-child > a,
#files-table tbody td:first-child > a {
  font-size: 1.04rem;
  font-weight: 800;
  color: #0f2a42;
  text-decoration: none;
  line-height: 1.3;
}
#folder-table tbody td:first-child > a:hover,
#files-table tbody td:first-child > a:hover {
  text-decoration: underline;
}
#folder-table tbody td:first-child,
#files-table tbody td:first-child {
  min-width: 220px;
}
@media (max-width: 900px) {
  #folder-table tbody td:first-child > a,
  #files-table tbody td:first-child > a {
    font-size: 1rem;
  }
}

/* tighten bottom logo spacing */
.page-footer {
  padding-top: 2px;
  padding-bottom: 16px;
}
.footer-logo {
  margin-top: 0;
}
@media (max-width: 900px) {
  .page-footer {
    padding-top: 0;
    padding-bottom: 12px;
  }
}


.sortable-table th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  position: relative;
  padding-right: 26px;
}
.sortable-table th.sortable::after {
  content: "↕";
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 11px;
  color: var(--muted);
  opacity: 0.7;
}
.sortable-table th.sortable.sort-asc::after { content: "↑"; color: var(--blue-dark); opacity: 1; }
.sortable-table th.sortable.sort-desc::after { content: "↓"; color: var(--blue-dark); opacity: 1; }
.sortable-table th.sortable .sort-order-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  margin-left: 6px;
  padding: 0 4px;
  border-radius: 999px;
  background: rgba(47,149,223,.12);
  color: var(--blue-dark);
  font-size: 10px;
  font-weight: 800;
  vertical-align: middle;
}
