:root {
  color-scheme: dark;
  --bg: #061421;
  --panel: #0d2130;
  --panel-2: #102939;
  --border: rgba(157, 202, 219, .14);
  --muted: #8ba4b2;
  --text: #eff8fb;
  --accent: #20c9a2;
  --accent-2: #19aede;
  --danger: #ef6b78;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at 88% 5%, rgba(25, 174, 222, .10), transparent 26rem),
    radial-gradient(circle at 48% 100%, rgba(32, 201, 162, .06), transparent 30rem),
    var(--bg);
}
button, input { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: 250px;
  display: flex;
  flex-direction: column;
  padding: 28px 18px;
  background: rgba(5, 21, 34, .86);
  border-right: 1px solid var(--border);
  backdrop-filter: blur(20px);
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  color: inherit;
  text-decoration: none;
}
.brand strong { display: block; font-size: 16px; }
.brand small { display: block; margin-top: 4px; color: var(--muted); font-size: 12px; }
.brand-mark {
  position: relative;
  flex: 0 0 auto;
  width: 39px;
  height: 43px;
  transform: rotate(30deg);
}
.brand-mark i {
  position: absolute;
  width: 27px;
  height: 27px;
  border-radius: 7px;
  background: linear-gradient(145deg, #24d4c2, #0e7cdc);
  box-shadow: 0 8px 25px rgba(18, 153, 221, .24);
}
.brand-mark i:nth-child(2) { left: 12px; top: 8px; background: linear-gradient(145deg, #237fe2, #7259e9); }
.brand-mark i:nth-child(3) { left: 2px; top: 17px; background: linear-gradient(145deg, #20c6ba, #3373e5); opacity: .88; }
.brand-mark.large { width: 58px; height: 64px; transform: rotate(30deg) scale(1.35); margin-bottom: 20px; }

nav { margin-top: 50px; display: grid; gap: 8px; }
nav a {
  display: flex;
  gap: 13px;
  align-items: center;
  padding: 13px 15px;
  border-radius: 10px;
  color: #a9bdc7;
  text-decoration: none;
  font-size: 14px;
}
nav a span { width: 21px; color: #c9d8de; font-size: 19px; }
nav a:hover, nav a.active { color: #77f1d1; background: rgba(31, 201, 162, .12); }
.secure-note {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-top: auto;
  padding: 15px;
  border: 1px solid var(--border);
  border-radius: 11px;
  color: #d8e7ec;
  background: rgba(15, 39, 53, .65);
}
.secure-note > span { color: #d7e7ed; }
.secure-note strong, .secure-note small { display: block; font-size: 12px; }
.secure-note small { margin-top: 5px; color: var(--muted); line-height: 1.45; }

body > main { margin-left: 250px; padding: 30px 34px 60px; }
header { display: flex; align-items: center; justify-content: space-between; gap: 25px; }
h1 { margin: 0; font-size: 26px; letter-spacing: -.03em; }
header p { margin: 5px 0 0; color: var(--muted); }
.header-actions { display: flex; gap: 10px; align-items: center; }
.search {
  width: min(370px, 31vw);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 15px;
  height: 43px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(15, 38, 54, .75);
  color: var(--muted);
}
.search span { font-size: 22px; }
.search input {
  width: 100%;
  border: 0;
  outline: 0;
  color: var(--text);
  background: transparent;
}
.search input::placeholder { color: #6e8796; }
.icon-button, .upload-open, .upload-submit, .login-card button {
  height: 43px;
  border: 0;
  border-radius: 10px;
  color: #03251e;
  background: linear-gradient(135deg, #21cda7, #22b8d7);
  cursor: pointer;
  font-weight: 700;
}
.upload-open { padding: 0 18px; }
.icon-button {
  width: 43px;
  color: #c3d6de;
  background: var(--panel);
  border: 1px solid var(--border);
}

.stats { display: flex; gap: 12px; margin: 29px 0 20px; }
.stats > div {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  color: #b7cad2;
  background: rgba(16, 40, 56, .75);
  font-size: 13px;
}
.stats span { color: #dcebf0; font-size: 18px; }
.stats strong { color: white; }

.alert {
  margin: 0 0 18px;
  padding: 12px 15px;
  border-radius: 9px;
  font-size: 14px;
}
.alert.error { color: #ffb5bd; background: rgba(239, 107, 120, .12); border: 1px solid rgba(239, 107, 120, .3); }
.alert.success { color: #83f1d4; background: rgba(32, 201, 162, .1); border: 1px solid rgba(32, 201, 162, .25); }

.app-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(260px, 1fr));
  gap: 15px;
}
.app-card {
  padding: 17px;
  min-width: 0;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: linear-gradient(145deg, rgba(18, 45, 62, .92), rgba(11, 31, 45, .94));
  box-shadow: 0 12px 32px rgba(0, 0, 0, .08);
}
.card-top { display: flex; align-items: flex-start; gap: 13px; min-width: 0; }
.app-icon {
  width: 58px;
  height: 58px;
  flex: 0 0 auto;
  border-radius: 13px;
  object-fit: cover;
  background: #17384b;
  box-shadow: 0 8px 20px rgba(0, 0, 0, .24);
}
.app-icon.fallback {
  display: grid;
  place-items: center;
  color: white;
  font-size: 27px;
  font-weight: 800;
  background: linear-gradient(145deg, #16b6d6, #5868e8);
}
.app-title { min-width: 0; padding-top: 3px; }
.app-title h2 {
  margin: 0 0 5px;
  overflow: hidden;
  font-size: 16px;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.app-title strong { color: var(--accent); font-size: 13px; }
.saved {
  margin-left: auto;
  padding: 4px 8px;
  border: 1px solid rgba(32, 201, 162, .45);
  border-radius: 99px;
  color: #53ddb8;
  font-size: 10px;
}
dl { margin: 18px 0 15px; display: grid; gap: 8px; }
dl div { display: flex; gap: 8px; color: #9cb1bd; font-size: 12px; min-width: 0; }
dt { width: 15px; color: #b9ccd4; }
dd { margin: 0; }
.bundle dd { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.card-actions { display: flex; gap: 8px; }
.download {
  display: grid;
  place-items: center;
  flex: 1;
  min-height: 39px;
  border-radius: 8px;
  color: #062c24;
  background: linear-gradient(135deg, #25d1a4, #20bfc6);
  text-decoration: none;
  font-weight: 750;
  font-size: 13px;
}
.delete {
  width: 39px;
  height: 39px;
  border: 1px solid var(--border);
  border-radius: 8px;
  color: #91a8b4;
  background: rgba(5, 20, 31, .45);
  cursor: pointer;
  font-size: 20px;
}
.delete:hover { color: #ff9da7; border-color: rgba(239, 107, 120, .4); }
.empty {
  grid-column: 1 / -1;
  padding: 72px 25px;
  border: 1px dashed rgba(151, 197, 215, .22);
  border-radius: 14px;
  text-align: center;
  background: rgba(13, 33, 48, .4);
}
.empty-icon { color: #27cbaa; font-size: 48px; }
.empty h2 { margin-bottom: 8px; }
.empty p { color: var(--muted); }
.empty .upload-open { margin-top: 12px; }
.no-results { padding: 60px; color: var(--muted); text-align: center; }

.upload-dialog {
  width: min(510px, calc(100vw - 30px));
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  color: var(--text);
  background: #0c2130;
  box-shadow: 0 30px 90px rgba(0, 0, 0, .6);
}
.upload-dialog::backdrop { background: rgba(1, 9, 15, .76); backdrop-filter: blur(5px); }
.upload-dialog form { position: relative; padding: 32px; text-align: center; }
.upload-dialog .close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: 0;
  color: #8ea5b1;
  background: none;
  cursor: pointer;
  font-size: 26px;
}
.upload-symbol {
  display: grid;
  place-items: center;
  width: 58px;
  height: 58px;
  margin: 0 auto 16px;
  border-radius: 16px;
  color: #062a22;
  background: linear-gradient(145deg, #25d1a5, #20b7d5);
  font-size: 27px;
  font-weight: 800;
}
.upload-dialog h2 { margin: 0; }
.upload-dialog > form > p { color: var(--muted); font-size: 14px; line-height: 1.55; }
.drop-zone {
  display: grid;
  gap: 8px;
  margin: 22px 0 16px;
  padding: 27px 15px;
  border: 1px dashed rgba(65, 213, 181, .4);
  border-radius: 11px;
  color: #61e0c0;
  background: rgba(32, 201, 162, .05);
  cursor: pointer;
}
.drop-zone input { display: none; }
.drop-zone small { color: var(--muted); }
.upload-submit { width: 100%; }
.upload-submit:disabled { cursor: wait; opacity: .72; }
.upload-progress {
  margin: 0 0 17px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  text-align: left;
  background: rgba(4, 20, 31, .5);
}
.progress-heading, .progress-details {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.progress-heading { color: #dcebef; font-size: 13px; }
.progress-heading span { color: #59e4c0; font-weight: 800; }
.progress-track {
  height: 9px;
  margin: 11px 0 8px;
  overflow: hidden;
  border-radius: 99px;
  background: rgba(118, 163, 179, .16);
}
.progress-track i {
  display: block;
  width: 0;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, #20cba3, #20b9d4);
  box-shadow: 0 0 18px rgba(32, 201, 162, .32);
  transition: width .18s ease;
}
.progress-details { color: var(--muted); font-size: 11px; }
.upload-error {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(239, 107, 120, .3);
  border-radius: 8px;
  color: #ffb2ba;
  background: rgba(239, 107, 120, .09);
  text-align: left;
  font-size: 12px;
}

.login-page { display: grid; place-items: center; }
.login-shell { width: min(430px, calc(100vw - 30px)); }
.login-card {
  padding: 42px;
  border: 1px solid var(--border);
  border-radius: 18px;
  text-align: center;
  background: rgba(12, 32, 46, .9);
  box-shadow: 0 35px 100px rgba(0, 0, 0, .28);
}
.login-card h1 { margin-top: 15px; }
.login-card > p { color: var(--muted); }
.login-card form { display: grid; gap: 14px; margin-top: 28px; text-align: left; }
.login-card label span { display: block; margin-bottom: 8px; color: #bbced6; font-size: 13px; }
.login-card input {
  width: 100%;
  height: 46px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: 9px;
  outline: none;
  color: var(--text);
  background: #071a28;
}
.login-card input:focus { border-color: rgba(32, 201, 162, .55); }
.login-card button { width: 100%; }
.login-secure { display: block; margin-top: 25px; color: #7993a1; }

@media (max-width: 1100px) {
  .app-grid { grid-template-columns: repeat(2, minmax(250px, 1fr)); }
  .sidebar { width: 220px; }
  body > main { margin-left: 220px; }
}
@media (max-width: 760px) {
  .sidebar { position: static; width: auto; padding: 18px; }
  .sidebar nav, .secure-note { display: none; }
  body > main { margin: 0; padding: 22px 16px 45px; }
  header { align-items: flex-start; }
  header h1 { font-size: 22px; }
  .header-actions { flex-wrap: wrap; justify-content: flex-end; }
  .search { order: 3; width: 100%; }
  .app-grid { grid-template-columns: 1fr; }
}
