/* ==========================================================================
   Additions layered on top of base.css (the original page's styling).
   Covers the login page, session chrome, quota display and admin console.
   ========================================================================== */

/* --- header / brand ----------------------------------------------------- */
.header-bar{
  display:flex; align-items:flex-start; justify-content:space-between;
  gap:20px; flex-wrap:wrap;
}
.brand{ display:flex; align-items:center; gap:14px; min-width:0; }
.brand-logo{
  height:44px; width:auto; flex:none;
  background:#fff; padding:5px 8px; border-radius:8px;
  box-shadow:0 1px 3px rgba(0,0,0,0.18);
}
.brand-text{ min-width:0; }
.brand-text h1{
  margin:0 0 3px 0; font-size:1.45rem; font-weight:700; letter-spacing:-0.01em;
}
.brand-text .subtitle{
  margin:0; font-size:0.88rem; color:rgba(255,255,255,0.85);
}

.session-box{
  display:flex; flex-direction:column; align-items:flex-end; gap:7px;
  font-size:0.82rem;
}
.session-who{ display:flex; flex-direction:column; align-items:flex-end; line-height:1.35; }
.session-name{ font-weight:600; color:#fff; }
.session-email{ color:rgba(255,255,255,0.78); font-size:0.78rem; }
.session-actions{ display:flex; align-items:center; gap:10px; }
.session-link{
  color:#fff; text-decoration:none; font-weight:600;
  border-bottom:1px solid rgba(255,255,255,0.45); padding-bottom:1px;
}
.session-link:hover{ border-bottom-color:#fff; }
.inline-form{ display:inline; margin:0; }
.session-signout{
  appearance:none; cursor:pointer; font:inherit; font-weight:600;
  color:var(--brand-dark); background:#fff; border:none;
  border-radius:6px; padding:5px 11px;
}
.session-signout:hover{ background:#eef4fd; }

/* --- login page --------------------------------------------------------- */
body.auth-page{ background:var(--surface-0); }
body.auth-page main{ max-width:none; padding:0; margin:0; }
.auth-shell{
  min-height:100vh; display:flex; flex-direction:column;
  align-items:center; justify-content:center; padding:40px 20px; gap:18px;
}
.auth-card{
  width:100%; max-width:420px; background:var(--surface-2);
  border:1px solid var(--border); border-radius:14px;
  box-shadow:0 2px 6px rgba(0,0,0,0.05), 0 12px 34px rgba(0,0,0,0.07);
  padding:34px 32px 28px; text-align:center;
}
.auth-logo{ height:52px; width:auto; margin-bottom:18px; }
.auth-title{
  margin:0 0 8px; font-size:1.18rem; font-weight:700; letter-spacing:-0.01em;
}
.auth-lead{
  margin:0 0 22px; font-size:0.9rem; color:var(--text-secondary);
}
.auth-form{ text-align:left; }
.auth-form label,
.stacked-form label{
  display:block; font-size:0.82rem; font-weight:600;
  color:var(--text-secondary); margin:0 0 5px;
}
.auth-form input,
.stacked-form input{
  width:100%; padding:11px 13px; font-size:0.95rem; font-family:inherit;
  border:1.5px solid var(--border-strong); border-radius:8px;
  background:var(--surface-1); margin-bottom:16px; outline:none;
}
.auth-form input:focus,
.stacked-form input:focus{
  border-color:var(--brand); box-shadow:0 0 0 3px rgba(42,120,214,0.15);
}
.auth-submit{
  width:100%; padding:12px 20px; font-size:0.95rem; font-weight:600;
  color:#fff; background:var(--brand); border:none; border-radius:8px;
  cursor:pointer; margin-top:4px;
}
.auth-submit:hover{ background:var(--brand-dark); }
.auth-note{
  margin:20px 0 0; font-size:0.78rem; color:var(--text-muted);
  line-height:1.5; text-align:left;
}
.auth-flash{ text-align:left; margin-bottom:16px; }
.auth-legal{
  margin:0; font-size:0.75rem; color:var(--text-muted);
  max-width:420px; text-align:center;
}

/* --- flash messages ----------------------------------------------------- */
.flash-stack{ display:flex; flex-direction:column; gap:9px; margin-bottom:18px; }
.flash{
  padding:11px 14px; border-radius:8px; font-size:0.88rem;
  border:1px solid var(--border-strong); background:var(--surface-2);
}
.flash-error{
  border-color:var(--critical); background:var(--critical-bg); color:#7d1d1d;
}
.flash-warning{
  border-color:var(--warning); background:var(--warning-bg); color:#6b4a05;
}
.flash-success{
  border-color:var(--good); background:var(--good-bg); color:#0a5c0a;
}

/* --- shared bits -------------------------------------------------------- */
.crumb{ margin:0 0 16px; font-size:0.87rem; }
.crumb a{ text-decoration:none; font-weight:600; }
.crumb a:hover{ text-decoration:underline; }
.narrow-card{ max-width:540px; }
.muted-note{ font-size:0.84rem; color:var(--text-muted); line-height:1.55; }
.stacked-form{ margin-top:16px; }
.policy-box{
  margin-top:20px; padding:14px 16px; border-radius:9px;
  background:var(--surface-0); border:1px solid var(--border);
  font-size:0.82rem; color:var(--text-secondary); line-height:1.55;
}
.policy-box ul{ margin:7px 0 9px; padding-left:20px; }
.policy-box b{ color:var(--text-primary); }
code{
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size:0.85em; background:var(--surface-0);
  border:1px solid var(--border); border-radius:5px; padding:1px 5px;
}
.sec-list{ padding-left:20px; line-height:1.65; font-size:0.92rem; }
.sec-list li{ margin-bottom:7px; }


/* --- export / notice lines --------------------------------------------- */
.export-note{
  font-size:0.78rem; color:var(--text-muted);
  margin-top:8px; line-height:1.5;
}
.loading-line{
  padding:18px 2px; font-size:0.9rem; color:var(--text-muted);
}

/* --- admin -------------------------------------------------------------- */
.btn-mini{
  appearance:none; cursor:pointer; font:inherit; font-size:0.76rem;
  font-weight:600; padding:4px 9px; margin:0 3px 3px 0;
  color:var(--brand-dark); background:var(--surface-1);
  border:1px solid var(--border-strong); border-radius:6px;
}
.btn-mini:hover{ background:#eef4fd; border-color:var(--brand); }
.btn-mini-danger{ color:var(--critical); }
.btn-mini-danger:hover{ background:var(--critical-bg); border-color:var(--critical); }
.lock-reason{
  font-size:0.72rem; color:var(--text-muted); margin-top:4px; max-width:260px;
}
.audit-table{ font-size:0.8rem; }
.audit-table .nowrap{ white-space:nowrap; }
.audit-detail{ max-width:340px; word-break:break-word; }
.audit-action{
  font-family:ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size:0.74rem; padding:2px 6px; border-radius:5px;
  background:var(--neutral-bg); white-space:nowrap;
}
.audit-sec{ background:var(--critical-bg); color:#7d1d1d; font-weight:700; }
.audit-exp{ background:var(--warning-bg); color:#6b4a05; font-weight:700; }
.audit-auth{ background:#eaf1fb; color:var(--brand-dark); }

/* --- errors ------------------------------------------------------------- */
.error-card{ text-align:center; margin-top:40px; }
.error-code{
  font-size:2.6rem; font-weight:800; color:var(--border-strong);
  line-height:1; margin-bottom:8px;
}

/* --- responsive --------------------------------------------------------- */
@media (max-width: 720px){
  .header-bar{ flex-direction:column; }
  .session-box{ align-items:flex-start; }
  .session-who{ align-items:flex-start; }
  .brand-text h1{ font-size:1.2rem; }
}

/* --- admin: access forms ------------------------------------------------ */
.access-grid{
  display:grid; grid-template-columns:repeat(auto-fit, minmax(300px, 1fr));
  gap:16px; margin:18px 0 4px;
}
.access-block{
  border:1px solid var(--border); border-radius:9px;
  padding:14px 16px 16px; margin:0; background:var(--surface-1);
}
.access-block-wide{ grid-column:1 / -1; }
.access-block legend{
  font-size:0.8rem; font-weight:700; text-transform:uppercase;
  letter-spacing:0.04em; color:var(--text-secondary); padding:0 6px;
}
.field-note{
  font-size:0.79rem; color:var(--text-muted);
  margin:0 0 10px; line-height:1.5;
}
.radio-row, .check-row{
  display:flex; gap:9px; align-items:flex-start;
  font-size:0.84rem; line-height:1.45; margin-bottom:10px; cursor:pointer;
}
.radio-row input, .check-row input{ margin-top:2px; flex:none; }
.radio-row b, .check-row b{ color:var(--text-primary); }
.radio-row span, .check-row span{ color:var(--text-secondary); }

.quota-grid{
  display:grid; grid-template-columns:repeat(auto-fit, minmax(180px, 1fr)); gap:14px;
}
.quota-field{ display:flex; flex-direction:column; min-width:0; }
.quota-field label{
  font-size:0.79rem; font-weight:600; color:var(--text-secondary); margin-bottom:5px;
}
.quota-field input{
  padding:9px 11px; font-size:0.9rem; font-family:inherit;
  border:1.5px solid var(--border-strong); border-radius:7px;
  background:var(--surface-2); outline:none; width:100%;
}
.quota-field input:focus{
  border-color:var(--brand); box-shadow:0 0 0 3px rgba(42,120,214,0.15);
}
.field-hint{ font-size:0.72rem; color:var(--text-muted); margin-top:4px; }

.new-user-row{
  display:grid; grid-template-columns:repeat(auto-fit, minmax(240px, 1fr));
  gap:14px; margin-bottom:4px;
}
.form-actions{
  display:flex; gap:10px; align-items:center; margin-top:18px; flex-wrap:wrap;
}
.form-actions .btn-secondary{ text-decoration:none; }

.cap{
  display:inline-block; font-size:0.68rem; font-weight:700;
  text-transform:uppercase; letter-spacing:0.03em;
  padding:2px 6px; border-radius:5px; margin-right:3px;
}
.cap-on{ background:var(--good-bg); color:#0a5c0a; }
.cap-off{
  background:var(--neutral-bg); color:var(--text-muted);
  text-decoration:line-through;
}
.allow{
  display:block; font-size:0.72rem; color:var(--text-muted); line-height:1.5;
}

/* --- admin layout ------------------------------------------------------- */
/* The checker's 1080px reading column is too narrow for the accounts table
   (8 columns, several of them nowrap), so admin pages get more room. */
body.admin-page main{ max-width:1440px; }
body.admin-page header.app-header .header-inner,
body.admin-page footer{ max-width:1440px; }

/* Any wide table scrolls inside its card instead of spilling past the edge.
   min-width:0 is what actually lets the flex/grid-less block shrink below
   its content width; without it the table forces the card wider. */
.table-scroll{
  overflow-x:auto;
  max-width:100%;
  min-width:0;
  -webkit-overflow-scrolling:touch;
}
.card{ min-width:0; }

/* Let the row actions wrap onto a second line rather than forcing the table
   wide enough to hold five buttons side by side. */
.admin-actions{ white-space:normal; min-width:170px; }
.admin-actions .btn-mini{ margin:0 3px 4px 0; }

/* Keep the wide columns from bloating: allow the email to break, and stop
   the allowance/access cells stretching the layout. */
.browse-table td:first-child{ word-break:break-word; min-width:150px; }
.access-cell{ white-space:nowrap; line-height:1.9; vertical-align:top; }

@media (max-width: 1100px){
  body.admin-page main{ max-width:100%; }
}

/* --- header access strip ------------------------------------------------ */
/* Sits on the blue header where the dataset figures used to be. Shows the
   signed-in account's own allowances and permissions -- nothing about the
   dataset itself. */
.access-strip{
  max-width:1080px; margin:16px auto 0;
  display:flex; flex-wrap:wrap; align-items:center; gap:8px 20px;
  font-size:0.82rem; color:rgba(255,255,255,0.86);
}
.access-label{
  font-size:0.7rem; font-weight:700; text-transform:uppercase;
  letter-spacing:0.06em; color:rgba(255,255,255,0.7);
  border-right:1px solid rgba(255,255,255,0.3); padding-right:18px;
}
.access-item b{ color:#fff; font-weight:600; }

.access-caps{ display:flex; flex-wrap:wrap; gap:6px; margin-left:auto; }
.access-cap{
  font-size:0.7rem; font-weight:600; padding:3px 9px; border-radius:20px;
  white-space:nowrap; border:1px solid transparent;
}
.access-cap.on{
  background:rgba(255,255,255,0.16); color:#fff;
  border-color:rgba(255,255,255,0.28);
}
.access-cap.off{
  background:rgba(0,0,0,0.16); color:rgba(255,255,255,0.55);
  border-color:rgba(255,255,255,0.14);
}

/* Nearing the daily substance allowance. */
.access-strip.access-warn{
  background:rgba(0,0,0,0.18); border-radius:8px;
  padding:9px 14px; margin-top:14px;
}
.access-strip.access-warn .access-item b{ color:var(--warning); }

body.admin-page .access-strip{ max-width:1440px; }

@media (max-width: 760px){
  .access-caps{ margin-left:0; }
  .access-label{ border-right:none; padding-right:0; }
}

/* Autolock table: the user-agent is context, not the headline. */
.lock-agent{
  font-size:0.74rem; color:var(--text-muted);
  max-width:190px; word-break:break-word;
}
