:root {
  --accent: #2f6fed;
  --accent-light: #dbeafe;
  --border: #d6dbe3;
  --text-primary: #0f172a;
  --text-secondary: #64748b;
  --surface-0: #f8fafc;
  --surface-1: #ffffff;
  --surface-2: #ffffff;
  --radius: 6px;
  --danger: #b3261e;
  --bg: #f4f6f9;
  --text: #1c2333;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 32px 16px;
  font: 15px/1.55 -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
}

@media (max-width: 600px) {
  body { padding: 18px 12px; }
}

/* ------------------------------------------------------------------ */
/* Layout                                                              */
/* ------------------------------------------------------------------ */
.layout {
  display: flex;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

.page {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-width: 0;
  height: 100vh;
  padding: 1.25rem 1.5rem;
  overflow: hidden;
}

/* ------------------------------------------------------------------ */
/* Top Bar                                                             */
/* ------------------------------------------------------------------ */
.top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  flex-wrap: nowrap;
  flex-shrink: 0;
  margin: 20px;
}

.top-bar h1 {
  font-weight: bold;
  font-size: 26px;
  margin: 0;
  color: var(--text-primary);
  flex-shrink: 0;
}

/* ------------------------------------------------------------------ */
/* Logged-in user                                                      */
/* ------------------------------------------------------------------ */
.top-bar-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: auto;
  flex-wrap: nowrap;
  flex-shrink: 0;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem 0.3rem 0.35rem;
  border: 0.5px solid var(--border);
  border-radius: 999px;
  background: var(--surface-1);
  font-size: 13px;
  color: var(--text-primary);
  max-width: 320px;
  flex-shrink: 0;
}

.user-chip img,
.user-chip .user-avatar-fallback {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-chip .user-avatar-fallback {
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-light);
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}

.user-chip-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 600;
}

.user-card {
  background: var(--surface-1);
  border: 0.5px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem 1.25rem;
  max-width: 640px;
}

.user-card h2 {
  margin: 0 0 0.9rem;
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.user-details {
  display: grid;
  grid-template-columns: minmax(130px, auto) 1fr;
  gap: 0.45rem 1rem;
  margin: 0;
  font-size: 13px;
}

.user-details dt {
  color: var(--text-secondary);
  font-weight: 600;
}

.user-details dd {
  margin: 0;
  color: var(--text-primary);
  overflow-wrap: anywhere;
}

/* ------------------------------------------------------------------ */
/* Buttons                                                             */
/* ------------------------------------------------------------------ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  height: 52px !important;
  padding: 0 35px !important;
  border: none !important;
  border-radius: 6px !important;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif !important;
  font-size: 15px !important;
  font-weight: 500 !important;
  cursor: pointer;
  margin: 0 !important;
}

.btn-accent {
  background: var(--accent);
  color: #ffffff;
}

.btn-accent:hover { background: #1d4ed8; }
.btn-accent:disabled { background: #93c5fd; cursor: not-allowed; }

.btn-secondary {
  border: 0.5px solid var(--border);
  background: var(--surface-2);
  color: var(--text-primary);
}

.btn-secondary:hover { background: #f1f5f9; }

/* ------------------------------------------------------------------ */
/* Info / error boxes                                                  */
/* ------------------------------------------------------------------ */
.hidden { display: none !important; }

.info-box {
  background: #eff6ff;
  border: 0.5px solid var(--accent-light);
  color: var(--text-primary);
  border-radius: 8px;
  padding: 0.6rem 0.9rem;
  font-size: 13px;
}

.error-box {
  background: #fdf2f2;
  border: 0.5px solid #fca5a5;
  color: #7b1d1d;
  border-radius: 8px;
  padding: 0.7rem 1rem;
  font-size: 13px;
  margin-bottom: 0.5rem;
}

.error-text {
  color: var(--danger);
  font-size: 12px;
}

/* ------------------------------------------------------------------ */
/* Loading spinner                                                     */
/* ------------------------------------------------------------------ */
.spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(37, 99, 235, 0.2);
  border-top-color: var(--accent);
  border-radius: 50%;
  margin-right: 0.5rem;
  animation: spin 0.7s linear infinite;
  flex-shrink: 0;
}
.login-container{
  display: flex;
  justify-content: center;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ */
/* Form controls                                                       */
/* ------------------------------------------------------------------ */
h1 { margin: 0 0 4px; font-size: 22px; letter-spacing: -0.2px; }

label { display: block; font-weight: 600; font-size: 13px; margin-bottom: 6px; }

input[type="text"],
input[type="email"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  padding: 9px 11px;
  font: inherit;
  color: var(--text);
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 7px;
  transition: border-color 0.12s, box-shadow 0.12s;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.16);
}

textarea { resize: vertical; min-height: 96px; }

input[type="date"],
input[type="time"] { cursor: pointer; }

button {
  padding: 10px 20px;
  font: inherit;
  font-weight: 600;
  border-radius: 7px;
  cursor: pointer;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--text);
}

button[disabled] { opacity: 0.6; cursor: not-allowed; }

/* ------------------------------------------------------------------ */
/* Support ticket form                                                 */
/* ------------------------------------------------------------------ */

.ticket-container {
  width: 94% !important;
  max-width: 1140px !important;
  margin: 14px auto 30px !important;
  background: #ffffff;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}

.header {
  width: 100%;
  background: #2864e8;
  padding: 22px 38px;
  text-align: center;
  color: white;
}

.logo-box {
  width: 150px !important;
  min-width: 150px !important;
  height: 64px;

  background: rgba(255, 255, 255, 0.18);
  border-radius: 5px;

  display: flex;
  align-items: center;
  justify-content: center;

  color: #ffffff;
  font-size: 13px;
}

.logo-box img {
  display: block;
  max-width: 128px;
  max-height: 44px;
  width: 100%;
  height: auto;
  filter: brightness(0) invert(1);
}

.header-title {
  margin: 0 !important;
  padding: 0 !important;

  color: #ffffff !important;
  font-size: 32px !important;
  font-weight: 700 !important;

  line-height: 1.2;
}

.form-content {
  width: 100%;
  padding: 35px 65px !important;
}

.info-message {
  width: 100%;

  background: #eef6ff;

  border-left: 5px solid #2864e8;

  border-radius: 5px;

  padding: 18px 19px;

  margin: 0 0 28px 0;

  font-size: 15px;
  line-height: 1.5;

  color: #16385f;
}

.info-message strong {
  font-weight: 700;
}

.section {
  width: 100%;
  margin: 0 0 48px 0;
}

.section-title {
  width: 100%;

  margin: 0 0 26px 0 !important;
  padding: 0 0 15px 0 !important;

  color: #2864e8 !important;

  font-size: 23px !important;
  font-weight: 600 !important;

  line-height: 1.2;

  border-bottom: 2px solid #f15a3a;
}

.form-row {
  width: 100%;

  display: grid !important;

  grid-template-columns:
    calc(50% - 12px) calc(50% - 12px) !important;

  column-gap: 24px !important;

  row-gap: 0 !important;

  margin: 0 0 26px 0 !important;

  padding: 0 !important;
}

.form-row.single {
  display: block !important;

  width: 100% !important;

  margin-bottom: 26px !important;
}

.form-group {
  width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
}

.form-label {
  display: block !important;

  width: 100%;

  margin: 0 0 10px 0 !important;
  padding: 0 !important;

  color: #10385f !important;

  font-size: 15px !important;
  font-weight: 400 !important;

  line-height: 1.4;
}

.required {
  color: #ef3d23 !important;
  font-weight: 600;
}

.form-input {
  display: block !important;

  width: 100% !important;
  height: 54px !important;

  margin: 0 !important;
  padding: 0 15px !important;

  border: 1px solid #d6d6d6 !important;
  border-radius: 5px !important;

  background: #ffffff !important;

  color: #101010 !important;

  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif !important;
  font-size: 15px !important;

  outline: none !important;

  box-shadow: none;
}

.form-input[readonly] {
  background: #e4f1ff !important;
}

.form-input::placeholder {
  color: #9b9b9b !important;
  opacity: 1;
}

.form-input:focus {
  border-color: #2864e8 !important;

  box-shadow:
    0 0 0 2px rgba(40, 100, 232, 0.10) !important;
}

.was-submitted .form-input:invalid,
.was-submitted .form-textarea:invalid,
.field-invalid {
  border-color: #dc2626 !important;
  box-shadow: 0 0 0 2px rgba(220, 38, 38, 0.12) !important;
}

.field-error {
  display: none;
  margin: 7px 0 0;
  color: #b91c1c;
  font-size: 13px;
}

.field-error.visible {
  display: block;
}

/* Result line under a field (e.g. when the email lookup fails). */
/* Always takes its line, even when empty: if it only appeared on blur, it would push the
   Submit button down between mousedown and mouseup and the click would be lost. */
.field-status {
  display: block;
  min-height: 20px;
  margin: 7px 0 0;
  font-size: 13px;
  line-height: 20px;
  color: #64748b;
}

.field-status.found {
  color: #15803d;
}

.field-status.not-found,
.field-status.error {
  color: #b91c1c;
}

.form-textarea {
  display: block !important;

  width: 100% !important;

  min-height: 125px !important;

  margin: 0 !important;
  padding: 15px !important;

  border: 1px solid #d6d6d6;
  border-radius: 5px !important;

  background: #ffffff !important;

  color: #101010 !important;

  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif !important;
  font-size: 15px !important;

  outline: none !important;

  resize: vertical;
}

.form-textarea::placeholder {
  color: #9b9b9b !important;
  opacity: 1;
}

.form-textarea:focus {
  border-color: #2864e8 !important;

  box-shadow:
    0 0 0 2px rgba(40, 100, 232, 0.10) !important;
}

/*
   Date & time: do NOT add emoji/icon. Browser already displays one.
*/
input[type="date"].form-input,
input[type="time"].form-input {
  padding-right: 12px !important;
}

.input-icon {
  display: none !important;
}

.button-container {
  width: 100%;

  display: flex !important;

  justify-content: flex-end !important;

  align-items: center;

  gap: 15px !important;

  margin: 42px 0 0 0 !important;
  padding: 0 !important;
}

.btn-clear {
  background: #eeeeee !important;
  color: #52606d !important;
}

.btn-clear:hover {
  background: #e2e2e2 !important;
}

.btn-submit {
  background: #2864e8 !important;
  color: #ffffff !important;
}

.btn-submit:hover {
  background: #1e55ce !important;
}

.success-view {
  width: 100%;
  padding: 70px 65px 170px 65px !important;
  text-align: center;
}

.success-icon {
  width: 64px;
  height: 64px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: #63ba73;
  color: #ffffff;
  font-size: 30px;
  line-height: 64px;
}

.success-title {
  margin: 0 0 10px 0;
  font-size: 24px;
  font-weight: 700;
  color: #16385f;
}

.success-question {
  margin: 0 0 28px 0;
  font-size: 15px;
  color: #52606d;
}

.auth-loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #52606d;
  font-family: "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
}

.logo-sp{
  width: 120px;
    height: 50px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
}

@media screen and (max-width: 768px) {

  .ticket-container {
    width: 100% !important;
    margin: 0 !important;
    border-radius: 0 !important;
  }

  .header {
    min-height: auto;

    padding: 25px !important;

    flex-direction: column;
    align-items: flex-start;

    gap: 20px;
  }

  .header-title {
    font-size: 30px !important;
  }

  .form-content {
    padding: 30px 25px !important;
  }

  .form-row {
    display: block !important;

    width: 100% !important;

    margin-bottom: 20px !important;
  }

  .form-row .form-group {
    width: 100% !important;

    margin-bottom: 20px !important;
  }

  .form-row .form-group:last-child {
    margin-bottom: 0;
  }

  .button-container {
    flex-direction: column-reverse !important;

    align-items: stretch !important;

    width: 100%;
  }

  .btn {
    width: 100% !important;
  }
}

/* ------------------------------------------------------------------ */
/* Attachments (support form)                                         */
/* ------------------------------------------------------------------ */
.optional {
  font-weight: 400;
  color: var(--text-secondary);
}

.field-hint {
  margin: 4px 0 0;
  font-size: 0.78rem;
  color: var(--text-secondary);
}

.attachment-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.attachment-list:empty {
  display: none;
}

.attachment-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #ffffff;
}

.attachment-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.attachment-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.attachment-size {
  font-size: 12px;
  color: #8a94a6;
}

.attachment-remove {
  flex: none;
  padding: 4px 10px;
  border: 0;
  border-radius: 4px;
  background: #f0f0f0;
  color: #666666;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
}

.attachment-remove:hover {
  background: #e0e0e0;
  color: #333333;
}

/* Drag and drop zone (a <label> around the real, visually hidden file input) */
.drop-zone {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 28px 20px;
  border: 2px dashed var(--accent);
  border-radius: 8px;
  background: #f8fafb;
  text-align: center;
  font-weight: 400;
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}

.drop-zone:hover {
  border-color: #1d4ed8;
  background: #f0f7ff;
}

.drop-zone.dragover {
  border-color: #f15a3a;
  background: #fff5f0;
}

.drop-zone:focus-within {
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.25);
}

.drop-zone-icon {
  color: var(--accent);
  pointer-events: none;
}

.drop-zone-text {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.drop-zone-hint {
  font-size: 12.5px;
  color: var(--text-secondary);
}

.drop-zone-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: 0;
  padding: 0;
  opacity: 0;
  overflow: hidden;
  pointer-events: none;
}

.file-counter {
  margin: 10px 0 0;
  font-size: 12.5px;
  color: var(--accent);
}

/* ------------------------------------------------------------------ */
/* Submitting overlay (support form)                                  */
/* ------------------------------------------------------------------ */
.submit-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;              /* below the error banner (9999) */
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, 0.55);
  backdrop-filter: blur(2px);
}

.submit-panel {
  width: 100%;
  max-width: 380px;
  padding: 32px 36px;
  border-radius: 10px;
  background: var(--surface-1);
  box-shadow: 0 10px 40px rgba(15, 23, 42, 0.25);
  text-align: center;
  outline: none;
}

.submit-spinner {
  width: 44px;
  height: 44px;
  margin: 0 auto 18px;
  border: 4px solid var(--accent-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: submit-spin 0.9s linear infinite;
}

.submit-title {
  margin: 0 0 6px;
  font-size: 1.1rem;
  color: var(--text-primary);
}

.submit-note,
.submit-status {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.submit-status {
  min-height: 1.2em;          /* reserve the line so the panel doesn't jump */
  margin-top: 10px;
}

.submit-progress {
  margin-top: 16px;
}

.submit-progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--accent-light);
}

.submit-progress-bar {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width 0.2s ease;
}

@keyframes submit-spin {
  to { transform: rotate(360deg); }
}

@keyframes submit-pulse {
  50% { opacity: 0.35; }
}

/* No spinning for people who asked for reduced motion: a gentle pulse instead. */
@media (prefers-reduced-motion: reduce) {
  .submit-spinner { animation: submit-pulse 1.6s ease-in-out infinite; }
  .submit-progress-bar { transition: none; }
}

/* Intro line above the support form */
.ticket-intro {
  margin: 0 0 22px;
  border-left: 4px solid var(--accent);
  font-size: 14px;
}

/* Buttons sit in their own section; the section above already gives the gap */
.form-actions .button-container { margin-top: 0 !important; }

/* ------------------------------------------------------------------ */
/* Signed-in user menu (top bar): the name opens a small menu          */
/* ------------------------------------------------------------------ */
.user-menu {
  position: relative;
}

button.user-chip {
  cursor: pointer;
  font-weight: 600;
  transition: background-color 0.15s, border-color 0.15s;
}

button.user-chip:hover,
button.user-chip[aria-expanded="true"] {
  background: #f1f5f9;
}

button.user-chip:focus-visible,
.user-menu-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.user-chip-caret {
  flex: none;
  width: 0;
  height: 0;
  margin-left: 2px;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid var(--text-secondary);
  transition: transform 0.15s;
}

button.user-chip[aria-expanded="true"] .user-chip-caret {
  transform: rotate(180deg);
}

.user-menu-panel {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 50;
  min-width: 250px;
  max-width: min(340px, 90vw);
  padding: 6px;
  background: #ffffff;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.15);
}

.user-menu-email {
  margin: 0 0 4px;
  padding: 6px 10px 8px;
  border-bottom: 1px solid #eef1f5;
  font-size: 12px;
  color: var(--text-secondary);
  overflow-wrap: anywhere;
}

.user-menu-email:empty {
  display: none;
}

.user-menu-item {
  display: block;
  width: 100%;
  padding: 8px 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  text-align: left;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
}

.user-menu-item:hover {
  background: #eff6ff;
  color: var(--accent);
}

.user-menu-item:disabled {
  opacity: 0.6;
  cursor: default;
}
