* { box-sizing: border-box; margin: 0; }
body { font-family: system-ui, sans-serif; background: #fafafa; color: #333; }
.hidden { display: none !important; }

#topbar { position: sticky; top: 0; background: #fff; padding: 10px 14px;
  display: flex; justify-content: space-between; align-items: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.1); z-index: 10; }
#topbar h1 { font-size: 18px; }
#whoami { font-size: 13px; color: #888; }

#nas-error { background: #c0392b; color: #fff; padding: 10px; text-align: center; }

#timeline { padding: 6px; }
.month-header { font-size: 16px; font-weight: bold; margin: 14px 4px 6px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 4px; }
.cell { position: relative; aspect-ratio: 1; background: #ddd; border-radius: 4px;
  overflow: hidden; cursor: pointer; }
.cell img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cell .badge { position: absolute; right: 4px; bottom: 4px; color: #fff;
  background: rgba(0,0,0,.55); border-radius: 3px; padding: 1px 5px; font-size: 12px; }
.cell .pending, .cell .fileicon { display: flex; align-items: center; justify-content: center;
  width: 100%; height: 100%; font-size: 12px; color: #777; text-align: center; padding: 4px; }

#empty-state { text-align: center; margin: 22vh 20px 0; color: #888; cursor: pointer; }
#empty-state .empty-icon { font-size: 48px; margin-bottom: 12px; }
#empty-state .empty-title { font-size: 17px; font-weight: bold; color: #555; margin-bottom: 8px; }
#empty-state .empty-text { font-size: 13px; line-height: 1.8; }

#add-btn { position: fixed; right: 18px; bottom: 18px; width: 56px; height: 56px;
  border-radius: 50%; border: none; background: #ff8a5c; color: #fff; font-size: 30px;
  box-shadow: 0 3px 8px rgba(0,0,0,.3); cursor: pointer; z-index: 20; }

.modal { position: fixed; inset: 0; background: rgba(0,0,0,.5);
  display: flex; align-items: center; justify-content: center; z-index: 40; }
.modal-box { background: #fff; border-radius: 10px; padding: 20px; min-width: 240px; }
.modal-box h2 { font-size: 16px; margin-bottom: 12px; }
#name-list button { display: block; width: 100%; margin: 6px 0; padding: 10px;
  font-size: 15px; border: 1px solid #ccc; border-radius: 6px; background: #fff; cursor: pointer; }

#upload-panel { position: fixed; left: 10px; right: 10px; bottom: 84px; background: #fff;
  border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,.25); padding: 10px;
  max-height: 40vh; overflow-y: auto; z-index: 30; font-size: 13px; }
.up-row { margin: 6px 0; }
.up-row progress { width: 100%; height: 8px; }
.up-row .err { color: #c0392b; }

#viewer { position: fixed; inset: 0; background: #000; z-index: 50;
  display: flex; align-items: center; justify-content: center; }
#viewer-content img, #viewer-content video { max-width: 100vw; max-height: 88vh; }
#viewer-caption { position: absolute; bottom: 10px; left: 0; right: 0;
  text-align: center; color: #fff; font-size: 13px; text-shadow: 0 1px 2px #000; }
#viewer button { position: absolute; background: rgba(255,255,255,.15); color: #fff;
  border: none; font-size: 28px; cursor: pointer; border-radius: 6px; padding: 4px 12px; }
#viewer-close { top: 10px; right: 10px; }
#viewer-prev { left: 6px; top: 50%; transform: translateY(-50%); }
#viewer-next { right: 6px; top: 50%; transform: translateY(-50%); }
