:root {
  --blue: #0b5cad;
  --blue-dark: #084a8a;
  --bg: #f2f6fb;
  --card: #ffffff;
  --text: #1c2733;
  --muted: #5b6b7c;
  --danger: #c62828;
  --radius: 14px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans Bengali", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.45;
}
.view { min-height: 100dvh; }
.center-view { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.center { text-align: center; }
.muted { color: var(--muted); }
.error { color: var(--danger); font-weight: 600; }
.warn { color: #8a6d00; background: #fff8e1; border-radius: 10px; padding: 8px 10px; font-size: 15px; }

.brand-badge {
  width: 56px; height: 56px; border-radius: 16px;
  background: var(--blue); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 30px;
  box-shadow: 0 4px 14px rgba(11, 92, 173, .35);
}
.brand-badge.big { width: 76px; height: 76px; font-size: 42px; border-radius: 20px; }
.brand-badge.small { width: 34px; height: 34px; font-size: 19px; border-radius: 9px; box-shadow: none; }

/* Auth */
#view-auth { display: flex; align-items: center; justify-content: center; padding: 20px 14px; }
.auth-card {
  background: var(--card); border-radius: 20px; padding: 26px 20px;
  width: 100%; max-width: 420px; text-align: center;
  box-shadow: 0 8px 30px rgba(20, 50, 90, .12);
}
.auth-card h1 { margin: 12px 0 2px; font-size: 28px; }
.auth-card .subtitle { color: var(--muted); margin: 0 0 14px; }
.auth-card h2 { font-size: 20px; margin: 14px 0 8px; }
.auth-card form { text-align: left; }
label { display: block; font-weight: 600; margin: 12px 0 6px; }
input[type="password"], input[type="text"], textarea {
  width: 100%; margin-top: 6px; padding: 13px 12px;
  border: 1.5px solid #c4d3e4; border-radius: 10px;
  font-size: 17px; font-family: inherit; background: #fff; color: var(--text);
}
input:focus, textarea:focus { outline: 2px solid var(--blue); border-color: var(--blue); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 12px; padding: 12px 18px;
  font-size: 16px; font-weight: 700; cursor: pointer; font-family: inherit;
  min-height: 50px; text-decoration: none;
}
.btn.primary { background: var(--blue); color: #fff; }
.btn.primary:active { background: var(--blue-dark); }
.btn.ghost { background: transparent; color: var(--blue); border: 1.5px solid #b9cee6; }
.btn.ghost.light { color: #fff; border-color: rgba(255,255,255,.5); }
.btn.danger { background: var(--danger); color: #fff; }
.btn.big-btn { width: 100%; margin-top: 16px; font-size: 18px; }

/* App frame */
.app-header {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  background: var(--blue); color: #fff; padding: 10px 14px;
}
.header-brand { display: flex; align-items: center; gap: 9px; font-size: 19px; }
.app-header .btn.ghost { color: #fff; border-color: rgba(255,255,255,.55); min-height: 42px; padding: 8px 12px; }
main { padding: 14px; max-width: 720px; margin: 0 auto; }

.storage-card {
  background: linear-gradient(135deg, #0b5cad, #2f80ed);
  color: #fff; border-radius: var(--radius); padding: 18px;
  box-shadow: 0 6px 18px rgba(11, 92, 173, .25);
}
.storage-title { font-weight: 700; opacity: .95; }
.storage-big { font-size: 34px; font-weight: 800; margin: 4px 0; }
.storage-card .muted { color: rgba(255, 255, 255, .85); font-size: 15px; }

.tiles { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 14px; }
.tile {
  background: var(--card); border: none; border-radius: var(--radius);
  padding: 22px 10px 16px; font-size: 20px; font-weight: 800; color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  box-shadow: 0 3px 10px rgba(20, 50, 90, .08); cursor: pointer; font-family: inherit;
  min-height: 118px;
}
.tile:active { transform: scale(.98); }
.tile-emoji { font-size: 38px; }
.tile-sub { font-size: 13px; color: var(--muted); font-weight: 600; }

.page-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.page-head h2 { margin: 0; font-size: 21px; }
.page-head .btn { min-height: 42px; padding: 8px 12px; }
.upload-btn { width: 100%; margin-bottom: 14px; }

/* Photos */
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.photo-grid button { padding: 0; border: none; background: #dbe7f3; border-radius: 10px; overflow: hidden; aspect-ratio: 1; cursor: pointer; }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Files + notes + links */
.file-list, .note-list, .link-list { display: flex; flex-direction: column; gap: 10px; }
.file-item, .note-item {
  background: var(--card); border-radius: var(--radius); padding: 12px 14px;
  display: flex; align-items: center; gap: 12px;
  box-shadow: 0 2px 8px rgba(20, 50, 90, .06);
}
.file-icon { font-size: 30px; }
.file-meta { flex: 1; min-width: 0; }
.file-name { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-sub { color: var(--muted); font-size: 14px; }
.file-item .btn, .note-item .btn { min-height: 44px; padding: 8px 12px; }
.note-item { align-items: flex-start; text-align: left; width: 100%; border: none; cursor: pointer; font-family: inherit; color: var(--text); }
.note-title { font-weight: 800; font-size: 17px; }
.note-snippet { color: var(--muted); font-size: 15px; margin-top: 2px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.link-item {
  background: var(--card); border-radius: var(--radius); padding: 17px 16px;
  font-size: 18px; font-weight: 700; color: var(--text); text-decoration: none;
  box-shadow: 0 2px 8px rgba(20, 50, 90, .06); display: block;
}
.link-item:active { background: #e8f1fa; }

/* Overlays */
.overlay {
  position: fixed; inset: 0; z-index: 20; background: rgba(5, 15, 28, .94);
  display: flex; flex-direction: column;
}
.overlay-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px 14px; color: #fff; font-weight: 700; }
.overlay-top span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#viewer-img { flex: 1; object-fit: contain; width: 100%; min-height: 0; }
.overlay-actions { display: flex; gap: 10px; padding: 14px; }
.overlay-actions .btn { flex: 1; }
.light-overlay { background: rgba(10, 25, 45, .55); align-items: center; justify-content: center; padding: 16px; }
.editor-card { background: #fff; border-radius: 18px; padding: 20px; width: 100%; max-width: 460px; }
.editor-card h2 { margin-top: 0; }
.row-gap { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.row-gap .btn { flex: 1; }

.progress-track { background: #dbe7f3; border-radius: 99px; height: 18px; overflow: hidden; margin: 14px 0 6px; }
#progress-bar { background: var(--blue); height: 100%; width: 0%; transition: width .2s; }

#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%);
  background: #17324f; color: #fff; padding: 12px 18px; border-radius: 99px;
  font-weight: 600; z-index: 40; max-width: 92vw; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.3);
}
