/* /assets/css/admin.css
   ==========================================================================
   ADMIN PANEL STYLESHEET
   Shared across /admin and /admin/new
   ==========================================================================
*/

/* --------------------------------------------------------------------------
   Design tokens
--------------------------------------------------------------------------- */
:root {
  --bg-page: #f5f5f5;
  --bg-card: #fff;

  --line: rgba(0,0,0,.08);
  --line-strong: rgba(0,0,0,.15);

  --fg: #111;
  --muted: #666;
  --muted-light: #999;

  --accent: #7A3A3A;
  --accent-bg: #f5ecec;

  --radius-lg: 16px;
  --radius-md: 10px;
  --radius-sm: 6px;
  --radius-pill: 6px;

  --shadow-card: 0 30px 60px rgba(0,0,0,.08);

  --font-stack: system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,"Helvetica Neue",sans-serif;
  --mono-stack: ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;

  --max-main-width: 800px;
  --max-form-width: 480px;

  --bg-pill-live: #e9fbe9;
  --fg-pill-live: #1d4d1d;

  --border-input: #ccc;
  --border-input-focus: #7A3A3A;
  --outline-focus: rgba(122,58,58,.15);

  --btn-bg: #000;
  --btn-fg: #fff;
  --btn-bg-hover: #222;
}

/* --------------------------------------------------------------------------
   Page shell
--------------------------------------------------------------------------- */

.admin-body {
  margin: 0;
  background: var(--bg-page);
  color: var(--fg);
  font-family: var(--font-stack);
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;

  display: flex;
  justify-content: center;

  padding: 2rem 1rem 4rem;
}

.admin-main {
  width: 100%;
  max-width: var(--max-main-width);
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* /admin/new narrower column */
.admin-main.narrow {
  max-width: var(--max-form-width);
}

/* vertical stacks used on /admin */
.stack-gap-lg {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* --------------------------------------------------------------------------
   Cards / panels
--------------------------------------------------------------------------- */

.card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
  padding: 1.5rem;
}

.card + .card {
  margin-top: 0;
}

/* Headings inside cards */

.card-headline {
  margin: 0 0 .75rem 0;
  color: #000;
  font-weight: 600;
  line-height: 1.3;
  font-size: 1.1rem;
}

.card-headline.lg {
  font-size: 1.4rem;
  line-height: 1.3;
  font-weight: 600;
  margin-bottom: 1rem;
}

@media (min-width:480px){
  .card-headline.lg {
    font-size: 1.6rem;
  }
}

.card-desc {
  color: var(--fg);
  font-size: .9rem;
  line-height: 1.4;
  margin: 0 0 1rem 0;
}
.card-desc .mono {
  font-family: var(--mono-stack);
  font-weight: 600;
}

.card-subtle {
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.4;
  margin: .25rem 0 1rem 0;
}
.card-subtle strong {
  color: #000;
  font-weight: 600;
}

.card-section-divider {
  border-top: 1px solid var(--line);
  margin: 1rem 0;
}

/* --------------------------------------------------------------------------
   Admin footer / version strip
--------------------------------------------------------------------------- */

.admin-footer {
  border-top: 1px solid var(--line);
  margin-top: 2rem;
  padding-top: 1rem;
  font-size: .8rem;
  line-height: 1.4;
  color: var(--muted);
}

.admin-footer-inner {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.admin-footer-left .admin-footer-note {
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.4;
  font-weight: 500;
}

.admin-footer-right {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: .5rem;
  font-size: .8rem;
  line-height: 1.4;
  color: var(--muted);
}

.admin-footer-product {
  color: #000;
  font-weight: 600;
  font-size: .8rem;
  line-height: 1.3;
}

.admin-footer-sep {
  color: var(--muted);
  line-height: 1;
}

.admin-footer-version-badge {
  font-family: var(--mono-stack);
  font-size: .75rem;
  line-height: 1.2;
  background: #f0f0f0;
  color: #000;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: 4px;
  padding: .25rem .4rem;
  font-weight: 500;
  white-space: nowrap;
  display: inline-block;
  min-width: max-content;
}

/* On wider screens, push version block to lower-right */
@media (min-width:480px){
  .admin-footer-inner {
    flex-direction: row;
    justify-content: space-between;
    align-items: flex-start;
  }

  .admin-footer-right {
    justify-content: flex-end;
  }
}

/* --------------------------------------------------------------------------
   Admin dashboard header block (/admin after auth)
--------------------------------------------------------------------------- */

.admin-header {
  position: relative;
}

.admin-header-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: .75rem;
}

.admin-header-left {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  font-size: .9rem;
  line-height: 1.4;
}

.admin-header-left h1 {
  font-size: 1.1rem;
  line-height: 1.3;
  font-weight: 600;
  color: #000;
  margin: 0;
}

.admin-header-left .muted {
  color: var(--muted);
  font-size: .85rem;
}

.admin-header-left a.back-link,
.admin-header-left a.inline-link {
  color: #2b2b8a;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

/* Sign out button in header (top-right) */
.signout-btn-small {
  appearance: none;
  background: none;
  border: 1px solid rgba(0,0,0,.15);
  border-radius: var(--radius-pill);
  color: var(--muted);
  font-size: .8rem;
  font-weight: 500;
  line-height: 1.2;
  padding: .4rem .8rem;
  cursor: pointer;
  transition: all .15s ease;
}
.signout-btn-small:hover {
  background: #f3f3f3;
  color: #000;
  border-color: rgba(0,0,0,.25);
}

/* --------------------------------------------------------------------------
   Clients list cards (/admin after auth)
--------------------------------------------------------------------------- */

.clients-card-head {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  margin-bottom: 1rem;
}

.clients-card-head .title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
}

.clients-card-head .title-row h2 {
  margin: 0;
  font-size: 1.05rem;
  line-height: 1.3;
  font-weight: 600;
  color: #000;
}

.clients-card-head .title-row .status-pill {
  background: var(--bg-pill-live);
  color: var(--fg-pill-live);
  border-radius: var(--radius-pill);
  border: 1px solid rgba(0,0,0,.08);
  font-size: .8rem;
  line-height: 1.2;
  font-weight: 500;
  padding: .4rem .55rem;
  white-space: nowrap;
  align-self: flex-start;
}

.clients-card-head .meta-row {
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.3;
  text-transform: uppercase;
  letter-spacing: .03em;
  font-weight: 500;
}

.client-block {
  border-top: 1px solid var(--line);
  padding-top: 1rem;
  margin-top: 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  font-size: .9rem;
  line-height: 1.4;
}
.client-block:first-of-type {
  border-top: 0;
  padding-top: 0;
  margin-top: 0;
}

.client-topline {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: .5rem .75rem;
}

.client-name {
  font-weight: 600;
  color: #000;
  font-size: 1rem;
  line-height: 1.3;
}

.client-pill-live {
  background: var(--bg-pill-live);
  color: var(--fg-pill-live);
  border-radius: var(--radius-pill);
  border: 1px solid rgba(0,0,0,.08);
  font-size: .8rem;
  line-height: 1.2;
  font-weight: 500;
  padding: .4rem .55rem;
  white-space: nowrap;
}

.client-meta {
  font-size: .8rem;
  color: var(--muted);
  line-height: 1.4;
}
.client-meta .mono {
  font-family: var(--mono-stack);
  background: #f0f0f0;
  border-radius: 4px;
  padding: .15rem .4rem;
  font-size: .75rem;
  color: #000;
  display: inline-block;
}

.client-links {
  font-size: .85rem;
  line-height: 1.4;
}
.client-links a {
  color: #2b2b8a;
  text-decoration: underline;
  text-underline-offset: 2px;
  margin-right: .5rem;
  word-break: break-word;
}

.empty-note {
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.4;
  padding: .5rem 0 0 0;
  margin: 0;
}

/* --------------------------------------------------------------------------
   Auth gate card (/admin before unlock)
--------------------------------------------------------------------------- */

.auth-card .card-headline.lg {
  margin-bottom: 1rem;
}
.auth-card .card-desc {
  font-size: .9rem;
}

@media (min-width:480px){
  .auth-card .card-headline.lg {
    font-size: 1.6rem;
  }
  .auth-card .card-desc {
    font-size: 1rem;
  }
}

.auth-form-group {
  display: flex;
  flex-direction: column;
  gap: .5rem;
  margin-bottom: 1rem;
}
.auth-form-label {
  font-weight: 500;
  font-size: .9rem;
  color: #000;
  line-height: 1.3;
}
.auth-input {
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: .7rem .65rem;
  font-size: 1rem;
  font-family: inherit;
}
.auth-input:focus {
  outline: 2px solid var(--outline-focus);
  border-color: var(--border-input-focus);
}
.auth-error {
  color: #b00020;
  font-size: .8rem;
  line-height: 1.4;
  min-height: 1em;
}

.auth-btn {
  appearance: none;
  background: var(--btn-bg);
  color: var(--btn-fg);
  border: 0;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.2;
  padding: .8rem 1rem;
  cursor: pointer;
  width: 100%;
  max-width: 460px;
  text-align: center;
}
.auth-btn:hover {
  background: var(--btn-bg-hover);
}

/* --------------------------------------------------------------------------
   /admin/new form builder card
--------------------------------------------------------------------------- */

.new-intro-block {
  font-size: .9rem;
  line-height: 1.4;
  color: var(--fg);
}
.new-intro-block h1 {
  margin: 0 0 .5rem 0;
  font-size: 1.1rem;
  font-weight: 600;
  color: #000;
  line-height: 1.3;
}
.new-intro-block .back-link {
  font-size: .9rem;
  color: #2b2b8a;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
  display: inline-block;
  margin-bottom: .75rem;
}
.new-intro-block .warn {
  font-weight: 600;
}
.new-intro-block .subtle {
  color: var(--muted);
  font-size: .8rem;
  line-height: 1.4;
  margin-top: .5rem;
}

.create-card .section-head {
  font-size: .8rem;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  line-height: 1.3;
  text-align: center;
  margin: 0 0 1rem 0;
  letter-spacing: .03em;
}

.field-block {
  display: flex;
  flex-direction: column;
  gap: .4rem;
  margin-bottom: 1rem;
  font-size: .9rem;
}
.field-block label {
  font-weight: 500;
  font-size: .8rem;
  color: #222;
}
.field-block small {
  font-size: .75rem;
  color: var(--muted);
  line-height: 1.4;
}

.text-input,
.text-input[readonly],
.text-input[type="text"],
.text-input[type="url"],
.text-input[type="password"] {
  border: 1px solid var(--border-input);
  border-radius: var(--radius-sm);
  padding: .7rem .65rem;
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.4;
  width: 100%;
  box-sizing: border-box;
  background: #fff;
}
.text-input[readonly] {
  background: #f9f9f9;
  cursor: not-allowed;
}
.text-input:focus {
  outline: 2px solid var(--outline-focus);
  border-color: var(--border-input-focus);
}

.lookup-wrap {
  background:#fff;
  border:1px solid #e5e5e5;
  border-radius:var(--radius-sm);
  padding:1rem;
  box-shadow:0 6px 20px rgba(0,0,0,.03);
  margin-bottom:1rem;
  font-size:.9rem;
}
.lookup-row {
  display:flex;
  flex-wrap:wrap;
  gap:.5rem;
  margin-bottom:.5rem;
}
.lookup-row .text-input {
  flex:1;
  min-width:0;
}

.search-btn {
  border:0;
  border-radius:var(--radius-sm);
  background:var(--accent);
  color:#fff;
  font-size:.9rem;
  font-weight:600;
  padding:.7rem 1rem;
  cursor:pointer;
  line-height:1.2;
  min-width:5rem;
}
.search-btn:hover {
  opacity:.9;
}

.lookup-hint {
  font-size:.75rem;
  color:var(--muted);
  line-height:1.4;
}

.lookup-results {
  margin-top:.75rem;
  border-top:1px solid #e5e5e5;
  padding-top:.75rem;
  max-height:180px;
  overflow-y:auto;
  font-size:.85rem;
  line-height:1.4;
  display:none;
}
.lookup-item {
  border:1px solid #ddd;
  border-radius:4px;
  background:#fff;
  padding:.5rem .5rem .6rem;
  margin-bottom:.5rem;
  cursor:pointer;
}
.lookup-item:hover {
  background:#fef7f7;
  border-color:var(--accent);
}
.lookup-name {
  font-weight:600;
  color:#111;
  font-size:.9rem;
  line-height:1.4;
}
.lookup-addr {
  color:#555;
  margin-top:.25rem;
  line-height:1.4;
}
.lookup-id {
  font-family:var(--mono-stack);
  font-size:.75rem;
  color:var(--accent);
  margin-top:.5rem;
  word-break:break-all;
  line-height:1.4;
}

.submit-block {
  text-align:center;
}
.submit-btn {
  appearance:none;
  background:#000;
  color:#fff;
  border:0;
  border-radius:var(--radius-sm);
  font-size:1rem;
  font-weight:600;
  line-height:1.2;
  padding:.8rem 1rem;
  cursor:pointer;
  width:100%;
  max-width:240px;
}
.submit-btn:hover {
  background:#222;
}

.result-box {
  display:none;
  background:#fafafa;
  border:1px solid #e5e5e5;
  border-radius:var(--radius-sm);
  padding:1rem;
  margin-top:1rem;
  font-size:.8rem;
  line-height:1.4;
  word-break:break-word;
  text-align:left;
}
.result-box a {
  color:#2b2b8a;
  text-decoration:underline;
  word-break:break-word;
  text-underline-offset:2px;
}
.result-box code {
  background:#eee;
  border-radius:4px;
  padding:.15rem .4rem;
  font-size:.75rem;
  font-family:var(--mono-stack);
}

.help-text {
  font-size:.75rem;
  color:var(--muted);
  line-height:1.4;
}

/* --------------------------------------------------------------------------
   Utilities
--------------------------------------------------------------------------- */

.mono {
  font-family: var(--mono-stack);
}

.muted {
  color: var(--muted);
}

.upper {
  text-transform: uppercase;
  letter-spacing: .03em;
}

.back-link-row {
  margin-bottom: .5rem;
  font-size: .9rem;
  line-height: 1.4;
}
.back-link-row a {
  color: #2b2b8a;
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

/* helpers toggled via JS */
.is-hidden {
  display: none !important;
}
.is-visible {
  display: block !important;
}

/* --------------------------------------------------------------------------
   Responsive tweaks
--------------------------------------------------------------------------- */

@media (min-width:480px){
  .new-intro-block h1 {
    font-size: 1.2rem;
  }
  .field-block label {
    font-size: .8rem;
  }
}

@media (min-width:640px){
  .admin-main {
    max-width: var(--max-main-width);
  }
  .admin-main.narrow {
    max-width: var(--max-form-width);
  }
}