:root {
  --bg: #0f1117;
  --surface: #181c27;
  --surface2: #1e2333;
  --border: #2a2f42;
  --accent: #4f6ef7;
  --danger: #f75c5c;
  --success: #4fce8f;
  --orange: #e8631a;
  --navy: #1a2744;
  --text: #e8eaf0;
  --text-dim: #7a82a0;
  --mono: ui-monospace, 'SF Mono', Menlo, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --radius: 7px;
}

* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }

html, body {
  height: 100%;
  font-family: var(--sans);
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}

/* ── AUTH ── */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--bg);
}
.auth-card {
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.auth-wordmark { font-size: 32px; font-weight: 700; color: var(--text); letter-spacing: 0.1em; }
.auth-divider { width: 40px; height: 3px; background: var(--orange); border-radius: 2px; }
.auth-title { font-size: 16px; color: var(--text-dim); font-family: var(--mono); }
.auth-sub { font-size: 13px; color: var(--text-dim); line-height: 1.7; max-width: 300px; }
.google-btn {
  display: flex; align-items: center; gap: 10px;
  background: #fff; border: none; border-radius: 8px;
  padding: 12px 24px; font-family: var(--sans); font-size: 15px;
  font-weight: 500; color: #3c4043; cursor: pointer;
  margin-top: 8px; box-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.auth-error {
  font-size: 12px; color: var(--danger); font-family: var(--mono);
  background: #200e0e; border: 1px solid var(--danger);
  border-radius: 6px; padding: 10px 14px; width: 100%; display: none;
}
.auth-error.show { display: block; }

/* ── APP LAYOUT ── */
.app-screen {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  max-width: 600px;
  margin: 0 auto;
}

/* ── HEADER ── */
.header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: #fff;
  border-bottom: 0.5px solid #e0e0e0;
  position: sticky; top: 0; z-index: 50;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-wordmark { font-size: 16px; font-weight: 700; color: var(--navy); letter-spacing: 0.08em; }
.header-sep { width: 1px; height: 14px; background: #d0d0d0; }
.header-tag { font-size: 13px; color: #888; }
.header-right { display: flex; align-items: center; gap: 8px; }
.header-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  background: #e8eef8; display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600; color: var(--navy); overflow: hidden;
}
.header-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.header-name { font-size: 12px; color: #888; font-family: var(--mono); }
.hamburger-btn {
  background: none; border: 0.5px solid #d0d0d0; border-radius: 7px;
  width: 32px; height: 32px; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
}
.hamburger-btn span { display: block; width: 14px; height: 1.5px; background: #888; border-radius: 2px; }

/* ── MENU ── */
.menu-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.4); z-index: 100;
}
.menu-overlay.show { display: block; }
.menu-panel {
  position: fixed; top: 0; right: 0; width: 240px; height: 100%;
  background: #fff; z-index: 101; padding: 20px;
  display: flex; flex-direction: column;
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
}
.menu-close {
  align-self: flex-end; background: none; border: none;
  cursor: pointer; color: #888; font-size: 24px; line-height: 1; margin-bottom: 20px;
}
.menu-av {
  width: 48px; height: 48px; border-radius: 50%;
  background: #e8eef8; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 600; color: var(--navy); margin-bottom: 12px; overflow: hidden;
}
.menu-av img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.menu-uname { font-size: 15px; font-weight: 500; color: #1a1a1a; }
.menu-uemail { font-size: 12px; color: #888; font-family: var(--mono); margin-top: 3px; }
.menu-session {
  font-size: 11px; color: #999; margin-top: 12px; padding-top: 12px;
  border-top: 0.5px solid #eee; font-family: var(--mono);
}
.menu-signout {
  margin-top: auto; width: 100%; padding: 11px;
  background: none; border: 0.5px solid #d0d0d0; border-radius: 7px;
  color: #666; font-size: 13px; cursor: pointer;
  display: flex; align-items: center; gap: 8px; font-family: var(--sans);
}

/* ── FORM ── */
.form-body {
  flex: 1;
  padding: 16px;
  display: flex; flex-direction: column; gap: 13px;
  background: var(--bg);
  padding-bottom: 100px;
}

.section-label {
  font-size: 10px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.1em; font-family: var(--mono);
  padding-bottom: 7px; border-bottom: 0.5px solid var(--border);
}
.section-label--mt { margin-top: 4px; }

.field { display: flex; flex-direction: column; gap: 5px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

label {
  font-size: 10px; font-weight: 600; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.07em; font-family: var(--mono);
}
.req { color: var(--orange); margin-left: 2px; }
.label-hint { font-size: 9px; font-weight: 400; text-transform: none; color: var(--text-dim); }

input, textarea, select {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-family: var(--sans);
  font-size: 15px; padding: 10px 12px; outline: none;
  transition: border-color 0.15s; width: 100%;
  -webkit-appearance: none; appearance: none;
}
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
input::placeholder, textarea::placeholder { color: var(--text-dim); }
input.err, textarea.err, select.err { border-color: var(--danger); background: #200e0e; }
select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' fill='none'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%237a82a0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center; padding-right: 32px;
}
select option { background: var(--surface2); }
textarea { resize: vertical; min-height: 80px; line-height: 1.6; }
.textarea-sm { min-height: 60px; }

/* ── CC ── */
.cc-wrap {
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 6px 10px;
  display: flex; flex-wrap: wrap; gap: 6px; align-items: center; min-height: 44px;
}
.cc-wrap:focus-within { border-color: var(--accent); }
.cc-tag {
  display: flex; align-items: center; gap: 5px;
  background: var(--navy); color: #fff;
  font-size: 12px; font-family: var(--mono); padding: 3px 9px; border-radius: 5px;
}
.cc-tag-x { background: none; border: none; color: rgba(255,255,255,0.7); cursor: pointer; font-size: 16px; padding: 0; line-height: 1; }
.cc-input {
  background: none; border: none; outline: none; color: var(--text);
  font-family: var(--sans); font-size: 15px; flex: 1; min-width: 140px; padding: 3px 0;
}
.cc-input::placeholder { color: var(--text-dim); }

/* ── URGENCY ── */
.urgency-row { display: flex; gap: 6px; }
.urg-btn {
  flex: 1; padding: 10px 4px; border-radius: var(--radius);
  font-family: var(--mono); font-size: 12px; cursor: pointer;
  text-align: center; border: 1px solid; display: flex;
  flex-direction: column; align-items: center; gap: 2px;
}
.urg-num { font-size: 14px; font-weight: 600; }
.urg-label { font-size: 9px; }
.urg-1 { background: #0e2018; border-color: #4fce8f; color: #4fce8f; }
.urg-2 { background: #1e2d1a; border-color: #7ecf5a; color: #7ecf5a; }
.urg-3 { background: #2a2710; border-color: #f7a24f; color: #f7a24f; }
.urg-4 { background: #2a1e10; border-color: #f78c4f; color: #f78c4f; }
.urg-5 { background: #2a1010; border-color: #f75c5c; color: #f75c5c; }
.urg-btn.selected { outline: 2px solid #fff; outline-offset: 1px; }
.urg-group.err { border: 1px solid var(--danger); border-radius: var(--radius); padding: 5px; background: #200e0e; }

/* ── FILE UPLOAD ── */
.upload-area {
  border: 1px dashed var(--border); border-radius: var(--radius);
  padding: 20px; text-align: center; cursor: pointer;
  background: var(--surface2);
}
.upload-icon { font-size: 24px; margin-bottom: 6px; }
.upload-title { font-size: 14px; font-weight: 500; color: var(--text); }
.upload-sub { font-size: 11px; color: var(--text-dim); margin-top: 3px; }
#fileInput { display: none; }

.file-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.file-grid-spacer { height: 8px; }
.file-thumb {
  position: relative; border-radius: var(--radius); overflow: hidden;
  border: 1px solid var(--border); aspect-ratio: 1;
  background: var(--surface2); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 4px;
}
.file-thumb img { width: 100%; height: 100%; object-fit: cover; }
.file-thumb-name {
  font-size: 8px; color: var(--text-dim); font-family: var(--mono);
  padding: 0 4px; overflow: hidden; text-overflow: ellipsis;
  white-space: nowrap; width: 100%; text-align: center;
}
.file-thumb-icon { font-size: 20px; }
.file-remove {
  position: absolute; top: 3px; right: 3px;
  background: rgba(0,0,0,0.7); border: none; border-radius: 50%;
  width: 18px; height: 18px; cursor: pointer; color: #fff; font-size: 11px;
  display: flex; align-items: center; justify-content: center;
}
.file-add {
  border: 1px dashed var(--border); border-radius: var(--radius); aspect-ratio: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 3px; cursor: pointer; background: var(--surface2);
  font-size: 11px; color: var(--text-dim); font-family: var(--mono);
}

/* ── CAPTURE STRIP ── */
.capture-strip {
  display: flex; gap: 10px; background: var(--surface2);
  border: 1px solid var(--border); border-radius: var(--radius);
  padding: 9px 12px; align-items: center; flex-wrap: wrap;
}
.cap-item { display: flex; align-items: center; gap: 5px; font-size: 11px; font-family: var(--mono); color: var(--text-dim); }
.cap-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.cap-dot.ready { background: var(--success); }

/* ── ERROR BAR ── */
.error-bar {
  display: none; background: #200e0e; border: 1px solid var(--danger);
  border-radius: var(--radius); padding: 10px 12px; font-size: 12px;
  color: var(--danger); font-family: var(--mono);
}
.error-bar.show { display: block; }

/* ── FOOTER ── */
.footer {
  position: fixed; bottom: 0; left: 0; right: 0;
  padding: 12px 16px 28px;
  background: var(--bg); border-top: 1px solid var(--border);
  max-width: 600px; margin: 0 auto;
}
.submit-btn {
  width: 100%; padding: 14px; background: var(--orange); border: none;
  border-radius: var(--radius); color: #fff; font-family: var(--sans); font-size: 15px;
  font-weight: 600; cursor: pointer; display: flex; align-items: center;
  justify-content: center; gap: 8px;
}
.submit-btn:disabled { background: var(--border); color: var(--text-dim); }

/* ── SUCCESS ── */
.success-overlay {
  display: none; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: var(--bg); z-index: 200;
  flex-direction: column; align-items: center; justify-content: center;
  padding: 40px 24px; text-align: center; gap: 16px;
  max-width: 600px; margin: 0 auto;
}
.success-overlay.show { display: flex; }
.success-icon {
  width: 72px; height: 72px; border-radius: 50%;
  background: #0e2018; border: 2px solid var(--success);
  display: flex; align-items: center; justify-content: center; font-size: 32px; color: var(--success);
}
.success-key {
  font-size: 14px; font-family: var(--mono); color: var(--accent);
  background: var(--surface2); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 5px 16px;
}
.success-title { font-size: 22px; font-weight: 600; color: var(--text); }
.success-sub { font-size: 14px; color: var(--text-dim); line-height: 1.7; max-width: 320px; }
.success-sub strong { color: var(--text); }
.btn-another {
  padding: 13px 32px; background: none; border: 1px solid var(--border);
  border-radius: var(--radius); color: var(--text); font-family: var(--sans);
  font-size: 15px; cursor: pointer; margin-top: 8px;
}

@keyframes spin { to { transform: rotate(360deg); } }
.spinner {
  width: 16px; height: 16px; border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff; border-radius: 50%;
  animation: spin 0.7s linear infinite; flex-shrink: 0;
}
