@import url('https://fonts.googleapis.com/css2?family=Ubuntu:wght@400;500;700&family=Ubuntu+Condensed&display=swap');

:root {
  --bg-color: #0b1120;
  --panel-color: rgba(17, 24, 39, 0.92);
  --panel-border: rgba(148, 163, 184, 0.12);
  --text-primary: #e2e8f0;
  --text-muted: #94a3b8;
  --accent: #38bdf8;
  --accent-strong: #0ea5e9;
  --danger: #f87171;
  --success: #34d399;
  --warning: #fbbf24;
  --shadow: 0 30px 60px -40px rgba(15, 118, 110, 0.6);
  --radius: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  font-family: 'Ubuntu', sans-serif;
  background: radial-gradient(circle at 20% 20%, rgba(14, 165, 233, 0.12), transparent 35%),
              radial-gradient(circle at 80% 10%, rgba(56, 189, 248, 0.14), transparent 45%),
              linear-gradient(160deg, #020617 0%, #0b1120 100%);
  color: var(--text-primary);
  padding-bottom: 0;
}

.portal-wordmark {
  display: inline-flex;
  align-items: baseline;
  gap: 0.4rem;
  font-family: 'Ubuntu', sans-serif;
  font-size: clamp(2.1rem, 3.8vw, 3rem);
  font-weight: 300;
  letter-spacing: 0.05em;
}

.portal-wordmark__hel {
  color: #f8fafc;
}

.portal-wordmark__system {
  color: var(--accent);
  font-weight: 500;
}

.mail-page-header,
.mail-page-heading {
  width: min(1200px, calc(100% - 48px));
  margin: 32px auto 12px;
  display: flex;
  align-items: center;
}

.mail-page-header {
  justify-content: space-between;
  gap: 20px;
}

.mail-page-heading {
  justify-content: center;
}

.mail-page-header__back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  padding: 8px 0;
  transition: color 0.2s ease;
}

.mail-page-header__back:hover {
  color: #f8fafc;
}

a {
  color: inherit;
}

.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 22px;
  backdrop-filter: blur(18px);
  background: rgba(15, 23, 42, 0.8);
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
  position: sticky;
  top: 0;
  z-index: 20;
  width: min(1200px, calc(100% - 48px));
  margin: 0 auto;
  border-radius: 0 0 var(--radius) var(--radius);
}

.nav-brand {
  font-family: 'Ubuntu Condensed', sans-serif;
  font-weight: 400;
  font-size: 1.7rem;
  letter-spacing: 0.05em;
  color: #e9ff2f;
  text-shadow: 0 0 12px rgba(233, 255, 47, 0.65);
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.nav-brand span {
  display: inline-block;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.nav-actions span {
  font-weight: 500;
}

.btn-link {
  text-decoration: none;
  color: var(--accent);
  font-weight: 600;
  padding: 10px 16px;
  border-radius: var(--radius-sm);
  transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
  background: rgba(56, 189, 248, 0.08);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-link:hover {
  color: #f8fafc;
  background: rgba(56, 189, 248, 0.18);
  transform: translateY(-1px);
}

.wrapper {
  width: min(1200px, calc(100% - 48px));
  margin: 42px auto 0;
  display: grid;
  gap: 28px;
  flex: 1 0 auto;
}

.panel {
  background: var(--panel-color);
  border-radius: var(--radius);
  border: 1px solid var(--panel-border);
  box-shadow: var(--shadow);
  padding: 28px;
}

.panel-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 18px;
}

.panel-header h1,
.panel-header h2 {
  margin: 0;
  font-weight: 600;
}

.panel-header h1 {
  font-size: clamp(1.6rem, 3vw, 2.1rem);
}

.panel-header h2 {
  font-size: clamp(1.2rem, 2.2vw, 1.6rem);
}

.panel-header p {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.95rem;
}

.summary-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.summary-card {
  padding: 22px;
  border-radius: var(--radius-sm);
  background: rgba(30, 41, 59, 0.88);
  border: 1px solid rgba(148, 163, 184, 0.08);
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: transform 0.2s ease;
}

.summary-card:hover {
  transform: translateY(-4px);
}

.summary-card .label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.summary-card .value {
  font-weight: 600;
  font-size: 1.4rem;
}

.summary-card .trend {
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.85);
}

.quota-progress {
  margin-top: 24px;
  padding: 18px 22px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(74, 222, 128, 0.35);
  background: linear-gradient(120deg, rgba(134, 239, 172, 0.18), rgba(22, 163, 74, 0.08));
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.quota-progress__header {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(226, 232, 240, 0.95);
}

.quota-progress__bar {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.25);
  overflow: hidden;
}

.quota-progress__fill {
  height: 100%;
  background: linear-gradient(90deg, rgba(74, 222, 128, 0.8), rgba(22, 163, 74, 0.9));
  transition: width 0.3s ease;
}

.mailbox-grid {
  display: grid;
  gap: 22px;
  grid-template-columns: repeat(auto-fit, minmax(390px, 1fr));
  margin: 18px 0 24px;
}

.mailbox-card {
  background: rgba(15, 23, 42, 0.72);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.12);
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: relative;
  box-shadow: 0 26px 46px -36px rgba(15, 118, 110, 0.7);
}

.mailbox-card.highlight {
  background: linear-gradient(160deg, rgba(134, 239, 172, 0.32), rgba(22, 163, 74, 0.12));
  border: 1px solid rgba(74, 222, 128, 0.45);
  box-shadow: 0 28px 60px -32px rgba(74, 222, 128, 0.55);
}

.mailbox-card.empty {
  justify-content: center;
  text-align: center;
  min-height: 180px;
}

.mailbox-card .card-header,
.mailbox-card .mailbox-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.mailbox-card .card-header h3,
.mailbox-card .mailbox-card-header h3 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 600;
}

.mailbox-card .mailbox-address {
  font-size: 1.35rem;
  color: #ff9d1b;
  text-shadow: 0 0 14px rgba(255, 157, 27, 0.65);
  letter-spacing: 0.01em;
}

.mailbox-card .card-header p,
.mailbox-card .mailbox-card-header p {
  margin: 4px 0 0;
  font-size: 0.88rem;
  color: rgba(226, 232, 240, 0.78);
}

.mailbox-card .mailbox-card-header .identity {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mailbox-card .delete-form {
  margin-left: auto;
}

.mailbox-card .delete-form button {
  padding: 8px 14px;
}

.mailbox-card .delete-form.confirm {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.mailbox-card .delete-confirm {
  display: flex;
  gap: 10px;
  align-items: center;
}

.mailbox-card .delete-form.confirm .btn-secondary {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.mailbox-card .delete-confirm input[type="text"] {
  width: 110px;
  text-align: center;
  letter-spacing: 0.25em;
  font-size: 1rem;
  font-weight: 600;
}

.mailbox-card .delete-hint {
  font-size: 0.8rem;
  color: var(--warning);
  text-align: right;
}

.mailbox-usage {
  display: grid;
  gap: 8px;
}

.mailbox-usage .quota {
  font-weight: 600;
  font-size: 1.05rem;
}

.mailbox-usage .meta {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.mailbox-usage .progress {
  height: 8px;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.18);
  overflow: hidden;
}

.mailbox-usage .progress span {
  display: block;
  height: 100%;
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  border-radius: inherit;
}

.mailbox-actions-grid {
  display: grid;
  gap: 14px;
}

.mailbox-actions-grid .inline-form {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fit, minmax(140px, max-content));
  align-items: center;
}

.mailbox-actions-grid .inline-form input[type="number"] {
  max-width: 140px;
}

.mailbox-actions-grid .inline-form select {
  max-width: 220px;
}

.mailbox-actions-grid .inline-form.limits {
  grid-template-columns: 1fr;
}

.mailbox-actions-grid .inline-form button {
  width: auto;
}

.mailbox-actions-grid .password-inline {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mailbox-actions-grid .password-inline input[type="password"] {
  flex: 1 1 auto;
  max-width: none;
}

.mailbox-actions-grid .limit-grid {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(2, minmax(80px, 1fr));
}

.mailbox-actions-grid .limit-grid input[type="number"] {
  width: 100%;
  max-width: 90px;
}

.mailbox-actions-grid .limit-checks {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 0.85rem;
}

.create-mailbox-form {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.create-mailbox-form .input-group.full {
  grid-column: 1 / -1;
}

.create-mailbox-form .password-field {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.create-mailbox-form button {
  justify-self: flex-start;
}

.table-wrapper {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.08);
  background: rgba(15, 23, 42, 0.35);
  margin: 18px 0 24px;
}

.table-wrapper table {
  margin: 0;
}

.flash {
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  background: rgba(30, 41, 59, 0.82);
  border: 1px solid rgba(148, 163, 184, 0.12);
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 0.93rem;
}

.flash.success {
  border-color: rgba(52, 211, 153, 0.35);
  background: rgba(20, 83, 45, 0.28);
  color: #bbf7d0;
}

.flash.error {
  border-color: rgba(248, 113, 113, 0.35);
  background: rgba(127, 29, 29, 0.28);
  color: #fecaca;
}

.flash.warning {
  border-color: rgba(251, 191, 36, 0.35);
  background: rgba(120, 53, 15, 0.24);
  color: #fde68a;
}

.section-title {
  font-size: 1.2rem;
  font-weight: 600;
  margin: 0 0 18px;
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 18px;
}

thead {
  background: rgba(30, 41, 59, 0.9);
}

thead th {
  text-align: left;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 0.92rem;
  color: rgba(226, 232, 240, 0.85);
}

tbody tr {
  border-bottom: 1px solid rgba(148, 163, 184, 0.08);
  transition: background 0.2s ease;
}

tbody tr:hover {
  background: rgba(59, 130, 246, 0.08);
}

tbody tr.mailbox-actions:hover {
  background: transparent;
}

tbody tr.mailbox-actions td {
  background: rgba(15, 23, 42, 0.55);
  border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.mailbox-actions .stacked-actions {
  margin-top: 12px;
}

td {
  padding: 14px 16px;
  font-size: 0.92rem;
  vertical-align: top;
  color: rgba(226, 232, 240, 0.92);
}

.quota-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 8px;
  font-size: 0.8rem;
  color: rgba(148, 163, 184, 0.85);
}

.quota-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

details summary {
  cursor: pointer;
  list-style: none;
  color: var(--accent);
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

details summary::-webkit-details-marker {
  display: none;
}

details[open] summary {
  color: #f8fafc;
}

.form-inline,
.inline-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}

.inline-form {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: center;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--text-muted);
}

.input-group span {
  font-weight: 500;
  color: rgba(226, 232, 240, 0.85);
}

.input-group small {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.grid-2 {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.form-inline {
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.label-block {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

input[type="text"],
input[type="password"],
input[type="email"],
select,
textarea {
  width: 100%;
  padding: 12px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.16);
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-primary);
  font-size: 0.95rem;
}

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

button {
  border: none;
  padding: 12px 18px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  cursor: pointer;
  font-size: 0.95rem;
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.icon {
  width: 1.1em;
  height: 1.1em;
  display: inline-block;
  flex-shrink: 0;
}

.heading-icon {
  width: 1.5em;
  height: 1.5em;
}

.brand-icon {
  width: 1.6em;
  height: 1.6em;
}

.with-icon {
  display: inline-flex;
  align-items: center;
  gap: 12px;
}

.with-icon > span {
  display: inline-block;
}

button:disabled,
.btn-primary:disabled,
.btn-danger:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-primary {
  background: linear-gradient(135deg, #38bdf8, #0ea5e9);
  color: #0f172a;
  box-shadow: 0 10px 30px -12px rgba(14, 165, 233, 0.65);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 16px 35px -14px rgba(56, 189, 248, 0.75);
}

.btn-secondary {
  background: rgba(15, 23, 42, 0.6);
  color: var(--text-primary);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.btn-secondary:hover {
  transform: translateY(-1px);
  background: rgba(30, 41, 59, 0.95);
}

.btn-danger {
  background: linear-gradient(135deg, #f87171, #ef4444);
  color: #0f172a;
}

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

.note {
  color: var(--text-muted);
  font-size: 0.85rem;
}

.stack {
  display: grid;
  gap: 28px;
}

.form-card {
  margin: 12px 0 24px;
  padding: 22px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(148, 163, 184, 0.12);
  background: rgba(15, 23, 42, 0.55);
  display: grid;
  gap: 18px;
}

.form-card h3 {
  margin: 0;
  font-weight: 600;
}

.grid-4 {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  align-items: flex-end;
}

.grid-4 .full {
  grid-column: 1 / -1;
}

.full {
  grid-column: 1 / -1;
  width: 100%;
}

.stacked-actions {
  display: grid;
  gap: 14px;
}

.actions-header {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.actions-header .icon {
  width: 1.2em;
  height: 1.2em;
}

.stacked-form {
  display: grid;
  gap: 12px;
}

.stacked-form label {
  display: grid;
  gap: 6px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.stacked-form span {
  font-weight: 500;
  color: rgba(226, 232, 240, 0.85);
}

.stacked-form input {
  background: rgba(15, 23, 42, 0.75);
}

.limit-grid {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, auto);
  justify-content: flex-start;
}

.limit-grid span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.limit-grid input {
  padding: 8px;
  width: 88px;
  text-align: right;
}

.limit-grid label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  white-space: nowrap;
}

.password-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.password-inline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.password-inline input[type="password"],
.password-inline input[type="text"] {
  flex: 1 1 200px;
}

.password-toggle {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
  cursor: pointer;
}

.password-toggle input {
  accent-color: var(--accent);
}

.footer {
  width: min(1200px, calc(100% - 48px));
  margin: 32px auto 24px;
  text-align: center;
  font-size: 0.85rem;
  color: rgba(148, 163, 184, 0.75);
  letter-spacing: 0.05em;
}

.limit-checks {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.limit-checks label {
  display: flex;
  align-items: center;
  gap: 6px;
}

.auth-wrapper {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.auth-panel {
  width: min(420px, 100%);
  background: rgba(15, 23, 42, 0.92);
  border-radius: var(--radius);
  border: 1px solid rgba(148, 163, 184, 0.12);
  box-shadow: var(--shadow);
  padding: 36px;
  display: grid;
  gap: 22px;
}

.auth-panel h1 {
  margin: 0;
  font-size: 1.8rem;
  font-weight: 600;
}

.auth-subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.auth-form {
  display: grid;
  gap: 16px;
}

.auth-form.otp-form {
  gap: 20px;
}

.code-inputs {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
}

.otp-input {
  width: 100%;
  padding: 14px 0;
  text-align: center;
  font-size: 1.5rem;
  letter-spacing: 0.12em;
  border-radius: calc(var(--radius) - 6px);
  background: rgba(15, 23, 42, 0.66);
  border: 1px solid rgba(148, 163, 184, 0.3);
  color: var(--text-primary);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.otp-input:focus {
  border-color: var(--brand-neon);
  box-shadow: 0 0 0 2px rgba(202, 255, 0, 0.18);
  outline: none;
}

.otp-hint {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: -4px;
}

.auth-form .btn-primary {
  margin-top: 8px;
}

@media (max-width: 720px) {
  .navbar {
    width: calc(100% - 32px);
    padding: 16px;
    flex-wrap: wrap;
    gap: 10px 16px;
    justify-content: center;
  }

  .nav-actions {
    width: 100%;
    justify-content: space-between;
  }

  .panel {
    padding: 22px;
  }

  thead {
    display: none;
  }

  tbody tr {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 12px;
    padding: 12px 0;
  }

  td {
    padding: 0 12px;
  }

  td::before {
    content: attr(data-label);
    display: block;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    font-size: 0.75rem;
    margin-bottom: 4px;
  }
}
