/* ==========================================================================
   TMail Unified Neo-Brutalist Dark Design System
   Shared across /, /add-domain, /dashboard, /api-docs, /admin-login,
   /admin, /ketentuan, and /privasi.
   ========================================================================== */

*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --bg:             #0E0E0E;
  --bg-deep:        #080808;
  --bg-carbon:      #141414;
  --surface:        #1A1A1A;
  --surface-raised: #222222;
  --surface-card:   #1C1C1C;
  --surface-hover:  #2A2A2A;
  --surface-active: #323232;

  --ink:            #FFFFFF;
  --text:           #ECECEC;
  --text-muted:     #A8A8B3;
  --text-dim:       #92929E;

  --border:         #333333;
  --border-strong:  #4A4A4A;
  --border-focus:   #666666;
  --border-w:       2px;

  --radius:         4px;
  --radius-sm:      4px;
  --radius-lg:      4px;
  --radius-pill:    4px;

  --red:            #FF2D2D;
  --red-hover:      #FF4D4D;
  --red-dark:       #AA0000;
  --red-btn:        #D11924;
  --red-btn-hover:  #B8141E;
  --red-glow:       rgba(255, 45, 45, 0.25);
  --red-soft:       rgba(255, 45, 45, 0.12);
  --red-border:     rgba(255, 45, 45, 0.45);

  --green:          #22C55E;
  --green-soft:     rgba(34, 197, 94, 0.12);
  --green-border:   rgba(34, 197, 94, 0.4);
  --green-glow:     rgba(34, 197, 94, 0.2);

  --yellow:         #FACC15;
  --yellow-soft:    rgba(250, 204, 21, 0.12);
  --yellow-border:  rgba(250, 204, 21, 0.4);

  --blue:           #60A5FA;
  --blue-soft:      rgba(96, 165, 250, 0.12);
  --blue-border:    rgba(96, 165, 250, 0.4);

  --orange:         #FB923C;
  --purple:         #C084FC;
  --purple-soft:    rgba(192, 132, 252, 0.12);
  --purple-border:  rgba(192, 132, 252, 0.4);

  --shadow-hard:    4px 4px 0px 0px rgba(255, 45, 45, 0.34);
  --shadow-hard-sm: 3px 3px 0px 0px rgba(0, 0, 0, 0.65);
  --shadow-hard-lg: 6px 6px 0px 0px rgba(255, 45, 45, 0.4);
  --shadow-sm:      3px 3px 0px 0px rgba(0, 0, 0, 0.65);
  --shadow-md:      4px 4px 0px 0px rgba(0, 0, 0, 0.75);
  --shadow-lg:      6px 6px 0px 0px rgba(0, 0, 0, 0.85);

  --font-display:   'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-main:      'Space Grotesk', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-mono:      'JetBrains Mono', monospace;
  --transition:     0.15s ease;
  --transition-slow: 0.22s ease;
  --shell-max-w:    920px;
}

:root[data-portal-theme="light"] {
  --bg:             #FAFAFA;
  --bg-deep:        #F4F4F5;
  --bg-carbon:      #F3F4F6;
  --surface:        #FFFFFF;
  --surface-raised: #F3F4F6;
  --surface-card:   #FFFFFF;
  --surface-hover:  #E6E7EB;
  --surface-active: #DCDDE2;
  --ink:            #1F2024;
  --text:           #1F2024;
  --text-muted:     #5C5D63;
  --text-dim:       #52525B;
  --border:         #D4D4D8;
  --border-strong:  #A1A1AA;
  --red:            #AA0000;
  --red-hover:      #8A0000;
  --red-dark:       #7A0000;
  --red-btn:        #AA0000;
  --red-btn-hover:  #8A0000;
  --red-glow:       rgba(170, 0, 0, 0.18);
  --red-soft:       #FCEAEA;
  --red-border:     rgba(170, 0, 0, 0.35);
  --green:          #15803D;
  --green-soft:     #DCFCE7;
  --yellow:         #B45309;
  --yellow-soft:    #FEF3C7;
  --shadow-hard:    4px 4px 0px 0px rgba(170, 0, 0, 0.22);
  --shadow-hard-sm: 3px 3px 0px 0px rgba(170, 0, 0, 0.18);
  --shadow-hard-lg: 6px 6px 0px 0px rgba(170, 0, 0, 0.25);
}

html {
  background: var(--bg);
  color-scheme: dark;
}

:root[data-portal-theme="light"] {
  color-scheme: light;
}

html[data-embed="1"] .topbar {
  display: none !important;
}

html[data-embed="1"] main,
html[data-embed="1"] .page-container {
  padding-top: 16px;
}

body {
  font-family: var(--font-display);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1.5;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a[href],
button:not(:disabled),
summary,
select:not(:disabled),
label[for],
input[type="checkbox"]:not(:disabled) {
  cursor: pointer;
}

button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
}

:focus-visible {
  outline: 2px solid var(--red);
  outline-offset: 2px;
}

dialog:modal {
  overscroll-behavior: contain;
}

dialog::backdrop {
  overflow: hidden;
  overscroll-behavior: contain;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Italic removal across headings per unified Neo-Brutalist spec */
.hero-title em,
.page-title em,
.page-hero h1 em {
  font-style: normal;
  color: var(--red);
}

/* ==========================================================================
   SHARED TOPBAR & PRIMARY NAVIGATION
   ========================================================================== */
.topbar {
  width: 100%;
  background: var(--surface);
  border-bottom: var(--border-w) solid var(--border);
  box-shadow: 0 4px 0 0 rgba(0, 0, 0, 0.45);
  padding: 8px 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 64px;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-inner {
  width: 100%;
  max-width: var(--shell-max-w);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar-brand-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex-shrink: 0;
}

.logo {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  transition: var(--transition);
  min-height: 40px;
  flex-shrink: 0;
}

.logo:hover {
  transform: translateY(-1px);
}

.logo-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 8px rgba(255, 30, 45, 0.35));
}

.logo-icon svg {
  width: 100%;
  height: 100%;
  display: block;
}

.logo-text {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 0.8px;
  line-height: 1;
}

.logo-text span {
  color: var(--red);
}

.topbar-nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.topbar-nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0 11px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--text-muted);
  background: transparent;
  border: 1.5px solid transparent;
  border-radius: var(--radius);
  white-space: nowrap;
  transition: var(--transition);
}

.topbar-nav-link:hover {
  color: var(--ink);
  background: var(--surface-raised);
  border-color: var(--border-strong);
}

.topbar-nav-link[aria-current="page"] {
  color: var(--ink);
  background: var(--surface-raised);
  border-color: var(--red);
  box-shadow: 2px 2px 0 0 rgba(255, 45, 45, 0.35);
}

.topbar-right,
.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

/* Language Switcher */
.lang-group {
  display: inline-flex;
  align-items: stretch;
  border: var(--border-w) solid var(--border-strong);
  border-radius: var(--radius);
  overflow: hidden;
  min-height: 38px;
  background: var(--bg);
  flex-shrink: 0;
}

.lang-btn {
  padding: 0 11px;
  min-width: 38px;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  transition: var(--transition);
  line-height: 1;
}

.lang-btn.active {
  background: var(--red-btn);
  color: #FFFFFF;
}

.lang-btn:not(.active):hover {
  background: var(--surface-hover);
  color: var(--ink);
}

/* Compact Back / Action Links */
.back-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 38px;
  padding: 0 12px;
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  border: var(--border-w) solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface-raised);
  box-shadow: var(--shadow-hard-sm);
  white-space: nowrap;
  flex-shrink: 0;
  transition: var(--transition);
}

.back-btn:hover {
  color: var(--ink);
  border-color: var(--red);
  background: var(--surface-hover);
  transform: translate(-1px, -1px);
  box-shadow: var(--shadow-hard);
}

.back-btn:active {
  transform: translate(1px, 1px);
  box-shadow: none;
}

/* Mobile Menu Trigger (< 840px) */
.mobile-nav-trigger {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 44px;
  min-height: 44px;
  padding: 0 10px;
  background: var(--surface-raised);
  border: var(--border-w) solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  box-shadow: var(--shadow-hard-sm);
  transition: var(--transition);
}

.mobile-nav-trigger:hover {
  border-color: var(--red);
}

@media (max-width: 860px) {
  .topbar-nav {
    display: none;
  }
  .mobile-nav-trigger {
    display: inline-flex;
  }
}

@media (max-width: 520px) {
  .topbar {
    padding: 6px 12px;
    min-height: 58px;
  }
  .logo-text {
    font-size: 16px;
  }
  .logo-icon {
    width: 32px;
    height: 32px;
  }
  .lang-btn {
    padding: 0 9px;
    min-width: 34px;
  }
}

/* Native Top-Layer Mobile Navigation Drawer (<dialog>) */
.nb-drawer-dialog {
  margin: 0;
  margin-left: auto;
  padding: 0;
  width: min(320px, 86dvw);
  max-width: 100dvw;
  height: 100dvh;
  max-height: 100dvh;
  border: none;
  border-left: var(--border-w) solid var(--border-strong);
  background: var(--surface);
  color: var(--text);
  box-shadow: -8px 0 32px rgba(0, 0, 0, 0.75);
}

.nb-drawer-dialog[open] {
  display: flex;
  flex-direction: column;
}

.nb-drawer-dialog::backdrop {
  background: rgba(0, 0, 0, 0.72);
}

.nb-drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: var(--border-w) solid var(--border);
  background: var(--bg-deep);
}

.nb-drawer-title {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: 0.6px;
}

.nb-drawer-title span {
  color: var(--red);
}

.nb-drawer-close {
  min-width: 44px;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-raised);
  border: var(--border-w) solid var(--border-strong);
  border-radius: var(--radius);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 20px;
  line-height: 1;
}

.nb-drawer-close:hover {
  border-color: var(--red);
  color: var(--red);
}

.nb-drawer-links {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 18px;
  flex: 1;
  overflow-y: auto;
}

.nb-drawer-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 46px;
  padding: 10px 14px;
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  text-decoration: none;
  color: var(--text);
  background: var(--surface-raised);
  border: var(--border-w) solid var(--border);
  border-radius: var(--radius);
  transition: var(--transition);
}

.nb-drawer-link:hover {
  border-color: var(--border-strong);
  color: var(--ink);
}

.nb-drawer-link[aria-current="page"] {
  border-color: var(--red);
  background: var(--red-soft);
  color: var(--ink);
}

.nb-drawer-footer {
  padding: 14px 18px;
  border-top: var(--border-w) solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  background: var(--bg-deep);
}

/* ==========================================================================
   SHARED FOOTER
   ========================================================================== */
.site-footer {
  margin-top: 48px;
  text-align: center;
  padding: 28px 16px 36px;
  border-top: var(--border-w) solid var(--border);
  width: 100%;
}

.footer-links {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.footer-links a {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--text-muted);
  text-decoration: none;
  letter-spacing: 0.5px;
  min-height: 32px;
  padding: 4px 6px;
  display: inline-flex;
  align-items: center;
  transition: color 0.15s ease, transform 0.15s ease;
}

.footer-links a:hover,
.footer-links a[aria-current="page"] {
  color: var(--red);
}

.footer-links .dot {
  color: var(--text-dim);
  font-size: 8px;
  user-select: none;
}

.footer-copy {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  margin: 0;
  letter-spacing: 0.3px;
}
