:root { color-scheme: dark; font-family: system-ui, sans-serif; }
* { box-sizing: border-box; }
body { margin: 0; background: #111827; color: #e5e7eb; }
main { max-width: 1400px; margin: auto; padding: 24px; }
.card { background: #1f2937; border: 1px solid #374151; border-radius: 14px; padding: 18px; }
.login { max-width: 430px; margin: 10vh auto; }
h1, h2 { margin-top: 0; }
header { display: flex; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; }
.layout { display: grid; grid-template-columns: minmax(300px, 38%) 1fr; gap: 18px; }
aside { max-height: calc(100vh - 140px); overflow: auto; }
label { display: block; margin: 12px 0; font-weight: 600; }
input, textarea { width: 100%; margin-top: 6px; border: 1px solid #4b5563; border-radius: 8px; padding: 11px; background: #111827; color: white; }
button { border: 0; border-radius: 8px; padding: 10px 14px; background: #2563eb; color: white; cursor: pointer; font-weight: 700; }
button.secondary { background: #4b5563; }
.message { padding: 12px; border-bottom: 1px solid #374151; cursor: pointer; }
.message:hover { background: #374151; }
.message.unread { font-weight: 800; }
.message .subject { margin-bottom: 5px; }
.message .meta { color: #9ca3af; font-size: .87rem; }
.mail-body { white-space: pre-wrap; line-height: 1.5; }
.error { color: #fca5a5; margin-top: 10px; }
.success { color: #86efac; margin-top: 10px; }
.empty { color: #9ca3af; padding: 30px; text-align: center; }
@media (max-width: 850px) {
  main { padding: 12px; }
  header { align-items: flex-start; flex-direction: column; }
  .layout { grid-template-columns: 1fr; }
  aside { max-height: 45vh; }
}

.mail-body a { color: #60a5fa; text-decoration: underline; overflow-wrap: anywhere; }
.mail-body { overflow-wrap: anywhere; }
.from-line { color: #9ca3af; }
.send-result { margin-top: 14px; padding: 10px; border-radius: 8px; white-space: pre-wrap; }
.send-result.success { background: rgba(34,197,94,.12); }
.send-result.error { background: rgba(239,68,68,.12); }
button:disabled { opacity: .55; cursor: wait; }


label small {
  display: block;
  margin-top: 4px;
  color: #9ca3af;
  font-size: 0.82rem;
  font-weight: 400;
}

.optional {
  margin-left: 5px;
  color: #9ca3af;
  font-size: 0.78rem;
  font-weight: 400;
}

input::placeholder,
textarea::placeholder {
  color: #6b7280;
}


.mail-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
}

.tab {
  background: #334155;
}

.tab.active {
  background: #2563eb;
}

.sender-line {
  color: #94a3b8;
}

.message-meta {
  white-space: pre-line;
  color: #cbd5e1;
  line-height: 1.55;
}

.status-badge {
  display: inline-block;
  margin: 6px 0;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.status-ok {
  background: rgba(34, 197, 94, 0.18);
  color: #86efac;
}

.status-warning {
  background: rgba(245, 158, 11, 0.18);
  color: #fde68a;
}

.reader-actions {
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid #374151;
}

button.danger {
  background: #b91c1c;
}


.delivery-failure-box {
  margin: 16px 0;
  padding: 16px;
  border: 1px solid #ef4444;
  border-radius: 10px;
  background: rgba(127, 29, 29, 0.22);
}

.delivery-failure-box h3 {
  margin: 0 0 10px;
}

.delivery-failure-status {
  margin-bottom: 10px;
  color: #fca5a5;
  font-weight: 800;
}

.delivery-failure-details {
  white-space: pre-line;
  line-height: 1.55;
  color: #e5e7eb;
}


.status-error {
  background: rgba(220, 38, 38, 0.2);
  color: #fca5a5;
}

.failed-message {
  border-left: 3px solid #ef4444;
}


.admin-panel {
  margin-top: 18px;
}

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

.user-form {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.user-form button {
  align-self: end;
}

select {
  width: 100%;
  margin-top: 6px;
  border: 1px solid #4b5563;
  border-radius: 8px;
  padding: 11px;
  background: #111827;
  color: white;
}

.users-list {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.user-row {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border: 1px solid #374151;
  border-radius: 10px;
  background: #111827;
}

@media (max-width: 850px) {
  .user-form {
    grid-template-columns: 1fr;
  }

  .user-row {
    align-items: flex-start;
    flex-direction: column;
  }
}


.automatic-closing-preview {
  margin-top: 10px;
  padding: 12px;
  border-left: 3px solid #2563eb;
  border-radius: 6px;
  background: rgba(37, 99, 235, 0.12);
  color: #cbd5e1;
}

.automatic-closing-preview span,
.automatic-closing-preview strong {
  display: block;
}

.automatic-closing-preview span {
  margin-bottom: 7px;
  color: #94a3b8;
  font-size: 0.82rem;
  font-weight: 400;
}


.remember-login {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 14px 0;
  font-weight: 500;
  cursor: pointer;
}

.remember-login input {
  width: auto;
  margin: 0;
}

.password-manager-note {
  margin: 12px 0 0;
  color: #94a3b8;
  font-size: 0.82rem;
  line-height: 1.4;
}


.permissions-editor {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(2, 6, 23, 0.82);
}

.permissions-editor[hidden] {
  display: none;
}

.permissions-dialog {
  width: min(620px, 100%);
  max-height: 90vh;
  overflow: auto;
  padding: 22px;
  border: 1px solid #475569;
  border-radius: 14px;
  background: #1f2937;
}

.permission-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 10px;
  margin: 18px 0;
}

.permission-grid label {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  padding: 12px;
  border: 1px solid #374151;
  border-radius: 9px;
  background: #111827;
}

.permission-grid input {
  width: auto;
  margin: 0;
}

@media (max-width: 650px) {
  .permission-grid {
    grid-template-columns: 1fr;
  }
}


.storage-info {
  margin-top: 8px;
  color: #94a3b8;
  font-size: 0.85rem;
  max-width: 360px;
}

.storage-text {
  margin-bottom: 6px;
}

.storage-progress {
  width: 100%;
  height: 12px;
  overflow: hidden;
  border: 1px solid #334155;
  border-radius: 999px;
  background: #111827;
}

.storage-progress-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #2563eb, #38bdf8);
  transition: width 0.25s ease;
}

.storage-progress-fill.unlimited {
  background: linear-gradient(90deg, #10b981, #34d399);
}

.storage-percent {
  margin-top: 6px;
  font-weight: 600;
  color: #e2e8f0;
}

.trash-toolbar {
  display: flex;
  justify-content: flex-end;
  padding: 8px 0 14px;
  border-bottom: 1px solid #374151;
}
