/* ======================================================================
   10-RESPONSIVE  -  Tablet / mobile layout adjustments
   ====================================================================== */

/* Tablet/mobile layout adjustments. */
@media (max-width: 1050px) {
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .stat + .stat { border-left: 0; }
  .stat:nth-child(even) { border-left: 1px solid var(--line); }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .file-row { grid-template-columns: minmax(190px,2fr) minmax(140px,1.3fr) minmax(100px,1fr) 75px 62px 190px; }
}
@media (max-width: 760px) {
  .login-layout { grid-template-columns: 1fr; }
  .sidebar { transform: translateX(-100%); transition: transform .2s ease; }
  .sidebar.open { transform: translateX(0); }
  .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 19; border: 0; background: #091a3666; }
  .main { margin-left: 0; }
  .mobile-menu { display: inline-grid; place-items: center; flex: none; width: 36px; height: 36px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: white; color: var(--ink); }
  .mobile-menu svg { width: 19px; height: 19px; }
  .topbar { justify-content: flex-start; gap: 10px; padding: 0 16px; }
  .top-actions { margin-left: auto; }
  .top-user > div:not(.avatar), .top-user > span { display: none; }
  .top-user { cursor: pointer; }
  .top-actions { position: relative; }
  .profile-card:not([hidden]) { position: absolute; top: 46px; right: 0; z-index: 30; display: grid; justify-items: center; gap: 6px; min-width: 220px; max-width: calc(100vw - 28px); padding: 16px; text-align: center; background: white; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
  .profile-card strong { font-size: 13px; overflow-wrap: anywhere; }
  .profile-card small { color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
  .profile-card .avatar { width: 48px; height: 48px; font-size: 14px; }
  .page { padding: 22px 15px 36px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .inline-form { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .wide { grid-column: auto; }
  .action-list { grid-template-columns: 1fr; }
  .file-row { grid-template-columns: 1fr 1fr; min-width: 0; gap: 8px 12px; padding: 12px 4px; }
  .file-row > div:first-child, .file-row > div:last-child { grid-column: 1 / -1; }
  .file-row > div:last-child { justify-content: flex-start; flex-wrap: wrap; white-space: normal; }
  .file-head { display: none; }
  .crumb { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .crumb > span:first-child, .crumb .crumb-sep { display: none; }
  .crumb strong { font-size: 15px; }
  .file-row > div:last-child .btn { min-height: 36px; padding: 0 14px; white-space: nowrap; }
}
@media (max-width: 480px) {
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); gap: 10px; }
  .stat { flex-direction: row; align-items: center; gap: 9px; min-height: 72px; padding: 11px; }
  .stat .stat-icon { width: 22px; height: 22px; border-radius: 0; }
  .stat .stat-icon svg { width: 20px; height: 20px; }
  .stat strong { font-size: 20px; }
  .material-pick { flex-direction: column; align-items: stretch; }
  .material-pick .btn, .material-pick .file-chip { width: 100%; box-sizing: border-box; }
  #generator-form .material-pick { padding: 10px; }
  .file-chip-remove { padding: 5px 9px; font-size: 11px; }
  #generator-form .file-chip { flex-wrap: wrap; }
  #generator-form .file-chip-name { flex: 1 1 100%; white-space: normal; overflow-wrap: anywhere; line-height: 1.4; }
  #generator-form .file-chip-remove { flex: 0 0 auto; }
  .modal-foot .btn { flex: 1 1 auto; }
  .pick-item { padding: 11px 12px; }
  .card { padding: 15px; }
  .action-list { grid-template-columns: 1fr; }
  .modal-backdrop { padding: 8px; }
  .modal-head, .modal-body, .modal-foot { padding-left: 13px; padding-right: 13px; }
  .modal-foot { flex-wrap: wrap; }
}

@media (max-width: 860px) {
  .login-layout { grid-template-columns: 1fr; }
  .login-story { min-height: 410px; padding: 24px clamp(22px, 6vw, 48px) 18px; }
  .login-copy { max-width: 400px; margin-top: 30px; }
  .login-copy h1 { max-width: 420px; font-size: clamp(36px, 6vw, 46px); }
  .login-art { width: min(60%, 340px); margin: 8px -8px -4px auto; }
  .login-panel { align-items: start; padding: 28px clamp(16px, 5vw, 36px) 40px; }
  .login-box { width: min(440px, 100%); margin: 0 auto; padding: 32px clamp(22px, 5vw, 36px) 26px; }
}

@media (max-width: 480px) {
  .login-story { min-height: 400px; padding: 22px 20px 14px; }
  .login-copy { max-width: 290px; margin-top: 28px; }
  .login-copy h1 { max-width: 290px; font-size: clamp(34px, 9.5vw, 40px); }
  .login-art { width: min(70%, 260px); margin: 8px -8px -4px auto; }
  .login-panel { padding: 22px 32px 32px; }
  .login-box { padding: 26px 20px 22px; }
  .login-box h2 { font-size: 33px; }
}

.logout-btn .logout-icon { flex: none; width: 16px; height: 16px; }

.preview-modal { max-width: 760px; width: calc(100vw - 24px); }
.preview-body { max-height: 70vh; overflow: auto; }
.pv-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.pv-page { padding: 18px 20px; background: white; border: 1px solid var(--line); border-radius: 8px; font-family: Georgia, "Times New Roman", serif; color: #111; overflow-wrap: anywhere; }
.pv-page p, .pv-page h3, .pv-page h4 { margin: 0; }
.pv-title { font-size: 18px; margin-bottom: 6px !important; }
.pv-h { font-size: 14px; margin: 16px 0 4px !important; }
.pv-note { font-size: 12px; margin-bottom: 3px !important; }
.pv-q { font-size: 13px; margin-top: 10px !important; }
.pv-indent { font-size: 13px; padding-left: 24px; margin-top: 2px !important; }
.pv-key { font-size: 13px; margin-top: 4px !important; }
@media (max-width: 760px) { .saved-item { flex-wrap: wrap; } .download-group { flex-wrap: wrap; } }

@media (max-width: 760px) {
  .login-story { display: none; }
  .login-panel { min-height: 100vh; place-items: start center; padding: clamp(38px, 8vh, 64px) 32px 36px; background: white; }
  .login-box { width: min(440px, 100%); margin: 0 auto; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .login-box .mobile-brand { display: block; margin: 0 0 38px; }
  .login-box h2 { font-size: 36px; }
  .login-help { margin-top: 22px; padding: 0; border: 0; text-align: center; font-size: 12px; }
}
.icon-delete { display: inline-grid; place-items: center; width: 34px; height: 34px; padding: 0; color: var(--red); background: var(--red-pale); border: 1px solid #f3b9b9; border-radius: 8px; cursor: pointer; }
.icon-delete:hover { color: white; background: var(--red); }
