* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top, #0f2347 0%, #081221 45%, #03070f 100%);
  color: #e2e8f0;
}
.page {
  min-height: 100vh;
}
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 18px 24px;
  background: rgba(15, 23, 60, 0.96);
  color: #fff;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.18);
}
.brand {
  font-size: 1.25rem;
  font-weight: 700;
}
.top-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 6px;
  padding: 10px 16px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}
.button-sm {
  padding: 8px 12px;
  font-size: 13px;
}
.button-primary {
  background: #2563eb;
  color: #fff;
  transition: transform 0.18s ease, background 0.18s ease, box-shadow 0.18s ease;
  box-shadow: 0 12px 28px rgba(37, 99, 235, 0.18);
}
.button-primary:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
}
.button-secondary {
  background: rgba(255,255,255,0.08);
  color: #fff;
  border: 1px solid rgba(226,232,240,0.18);
}
.button.button-secondary.button-sm {
  color: #000;
}
.button-danger {
  background: #ef4444;
  color: #fff;
}
.alert {
  margin-bottom: 16px;
  padding: 14px 16px;
  border-radius: 12px;
}
.alert-error {
  background: #fee2e2;
  color: #991b1b;
}
.alert-success {
  background: #d1fae5;
  color: #065f46;
}
.auth-page {
  min-height: calc(100vh - 76px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: radial-gradient(circle at top, rgba(59,130,246,0.12) 0%, rgba(15,23,42,0.9) 55%, #03070f 100%);
}
.panel {
  background: #fff;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}
.dashboard-page {
  padding: 32px 24px;
}
.chat-page {
  padding: 32px 24px;
  max-width: 1280px;
  margin: 0 auto;
}
.chat-layout {
  display: grid;
  grid-template-columns: minmax(260px, 0.9fr) minmax(440px, 1.7fr);
  gap: 24px;
}
.chat-layout .chat-groups-panel {
  grid-column: 1;
}
.chat-layout .chat-form-panel {
  grid-column: 2;
}
.chat-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.chat-groups-panel .panel-light,
.chat-form-panel .panel-light,
.chat-log-panel .panel-light {
  background: rgba(255,255,255,0.98);
}
.panel-head {
  margin-bottom: 20px;
}
.group-list {
  display: grid;
  gap: 12px;
}
.incoming-container {
  margin-bottom: 24px;
}
.incoming-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}
.incoming-search-form {
  display: flex;
  gap: 10px;
  align-items: center;
}
.incoming-search-input {
  min-width: 180px;
  padding: 12px 14px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  background: #f8fafc;
  color: #0f172a;
}
.incoming-list {
  display: grid;
  gap: 12px;
  max-height: 360px;
  overflow-y: auto;
  padding-right: 4px;
}
.incoming-item {
  padding: 16px;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  background: #ffffff;
  box-shadow: 0 18px 36px rgba(15, 23, 42, 0.06);
}
.incoming-item.incoming-new {
  border-color: #bfdbfe;
}
.incoming-header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}
.incoming-name {
  font-weight: 700;
  color: #0f172a;
}
.sender-username {
  color: #64748b;
  font-size: 0.95rem;
}
.incoming-time {
  font-size: 12px;
  color: #64748b;
}
.incoming-snippet {
  color: #475569;
  font-size: 14px;
  margin-bottom: 12px;
  line-height: 1.5;
}
.incoming-actions {
  display: flex;
  justify-content: flex-end;
}
.incoming-actions .button-sm {
  min-width: 90px;
}
.group-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1px solid #dbeafe;
  background: #f8fafc;
  color: #0f172a;
  text-decoration: none;
  font-weight: 600;
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.group-item:hover {
  background: #eff6ff;
  transform: translateX(2px);
}
.group-item.active {
  background: #2563eb;
  color: #fff;
  border-color: #1d4ed8;
}
.group-item.active .group-notice {
  background: rgba(255,255,255,0.2);
  color: #fff;
}
.group-summary-grid {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}
.group-summary-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-radius: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  color: #0f172a;
}
.group-summary-item.has-notice {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.group-summary-name {
  font-weight: 600;
}
.group-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 700;
  background: #e0f2fe;
  color: #0c4a6e;
}
.group-badge.empty {
  background: #f1f5f9;
  color: #64748b;
}
.group-notice {
  margin-left: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border-radius: 999px;
  background: rgba(37, 99, 235, 0.1);
  color: #1d4ed8;
  font-size: 12px;
}
.group-notice .bell,
.group-badge .bell {
  display: inline-block;
}
.chat-form {
  display: grid;
  gap: 20px;
}
.form-row {
  display: grid;
  gap: 10px;
}
.form-row label {
  color: #475569;
  font-size: 0.95rem;
}
.chat-form .form-row input,
.chat-form .form-row textarea,
.filter-form input,
.filter-form select {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  font-size: 15px;
  background: #f8fafc;
  color: #0f172a;
}
.chat-form .form-row textarea {
  min-height: 150px;
  resize: vertical;
}
.chat-form .form-actions {
  justify-content: flex-end;
}
.chat-layout {
  display: grid;
  grid-template-columns: minmax(240px, 1fr) minmax(460px, 1.7fr);
  gap: 24px;
}
.chat-panel .panel-light {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 22px;
  padding: 24px;
}
.chat-form-panel .panel-head h2,
.chat-groups-panel .panel-head h2,
.chat-log-panel .panel-head h2 {
  margin: 0;
  color: #0f172a;
  font-size: 1.2rem;
}
.chat-log-panel .table-wrap {
  overflow-x: auto;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
}
.chat-log-panel table {
  width: 100%;
  border-collapse: collapse;
  min-width: 680px;
}
.chat-log-panel table th,
.chat-log-panel table td {
  padding: 14px 16px;
  border-bottom: 1px solid #e2e8f0;
  text-align: left;
  font-size: 14px;
  color: #334155;
}
.chat-log-panel table th {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 700;
}
.chat-log-panel table tbody tr:hover {
  background: #f1f5f9;
}
.chat-log-panel table tbody tr td:first-child {
  font-weight: 600;
}
.panel-subsection {
  margin-top: 28px;
}
.modal-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
  color: #334155;
}
.empty-state {
  color: #64748b;
  padding: 16px 0;
  text-align: center;
}
.message-card {
  padding: 22px;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.message-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}
.message-date {
  color: #64748b;
  font-size: 13px;
  margin-top: 6px;
}
.reply-box {
  padding: 16px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  margin-top: 16px;
}
.reply-title {
  font-weight: 700;
  margin-bottom: 10px;
}
.form-row label {
  color: #334155;
}
.form-row input,
.form-row textarea {
  width: 100%;
}
.form-row-inline {
  display: grid;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
}
.empty-state {
  color: #64748b;
  padding: 16px 0;
}
.message-list {
  display: grid;
  gap: 18px;
}
.message-card {
  padding: 22px;
  border-radius: 18px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
  background: #f8fafc;
  border: 1px solid #e2e8f0;
}
.message-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 12px;
}
.message-date {
  color: #64748b;
  font-size: 13px;
  margin-top: 6px;
}
.reply-box {
  padding: 16px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 14px;
  margin-top: 16px;
}
.reply-title {
  font-weight: 700;
  margin-bottom: 10px;
}
.auth-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: stretch;
  width: min(1080px, 100%);
}
.auth-box.single {
  grid-template-columns: 1fr;
  max-width: 420px;
  width: 100%;
}
.auth-section {
  background: linear-gradient(180deg, rgba(7, 18, 42, 0.94) 0%, rgba(20, 42, 88, 0.98) 100%);
  padding: 36px 32px;
  border-radius: 28px;
  border: 1px solid rgba(56, 150, 255, 0.22);
  box-shadow: 0 32px 80px rgba(15, 23, 42, 0.35);
  backdrop-filter: blur(18px);
}
.auth-section h2 {
  margin-top: 0;
  color: #f8fafc;
  font-size: 2rem;
  margin-bottom: 14px;
  text-shadow: 0 3px 14px rgba(37, 99, 235, 0.25);
}
.auth-login-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}
.button-link {
  background: none;
  border: none;
  color: #7dd3fc;
  padding: 0;
  cursor: pointer;
  font-weight: 700;
  text-decoration: underline;
}
.button-link:hover {
  color: #38bdf8;
}
.auth-helper {
  margin-top: 18px;
  color: #cbd5e1;
  font-size: 0.95rem;
}
.auth-section label {
  display: block;
  margin: 18px 0 10px;
  font-weight: 600;
  color: #cbd5e1;
}
.login-brand {
  text-align: center;
  margin-bottom: 28px;
}
.login-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  height: 72px;
  margin: 0 auto 18px;
  border-radius: 18px;
  background: rgba(96, 165, 250, 0.12);
  color: #60a5fa;
  font-size: 0.9rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}
.login-brand p {
  margin: 0;
  color: #94a3b8;
  line-height: 1.6;
}
.auth-section input,
.auth-section textarea,
.filter-form input,
.filter-form select {
  width: 100%;
  padding: 16px 18px;
  border: 1px solid rgba(96, 165, 250, 0.45);
  border-radius: 16px;
  font-size: 14px;
  background: rgba(255,255,255,0.08);
  color: #f8fafc;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}
.auth-section input::placeholder,
.auth-section textarea::placeholder {
  color: rgba(255,255,255,0.65);
}
.login-form .button-primary,
.auth-section .button-primary {
  width: 100%;
  padding: 14px 18px;
  margin-top: 20px;
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #ffffff;
  box-shadow: 0 16px 30px rgba(59, 130, 246, 0.24);
}
.auth-section .button-primary:hover,
.login-form .button-primary:hover {
  background: linear-gradient(135deg, #1d4ed8, #2563eb);
}
.auth-section textarea {
  resize: vertical;
}
.auth-section input:focus,
.auth-section textarea:focus,
.filter-form input:focus,
.filter-form select:focus {
  outline: none;
  border-color: #7dd3fc;
  background: rgba(255,255,255,0.14);
  box-shadow: 0 0 0 6px rgba(96, 165, 250, 0.18);
}
.dashboard-page .user-panel {
  display: grid;
  gap: 24px;
  max-width: 1080px;
  margin: 0 auto;
}
.panel {
  background: #fff;
  padding: 24px;
  border-radius: 16px;
  box-shadow: 0 16px 40px rgba(15, 23, 42, 0.08);
}
.panel h2,
.panel h1 {
  margin-top: 0;
}
.message-list {
  display: grid;
  gap: 14px;
}
.message-card {
  padding: 18px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  background: #f8fafc;
}
.message-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-weight: 600;
}
.message-content,
.reply-box {
  margin-bottom: 12px;
}
.message-attach a {
  color: #2563eb;
  text-decoration: none;
}
.message-status {
  display: inline-flex;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 13px;
}
.status-new {
  background: #e0f2fe;
  color: #0c4a6e;
}
.status-replied {
  background: #dcfce7;
  color: #166534;
}
.reply-box {
  padding: 16px;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
}
.admin-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: calc(100vh - 0px);
}
.sidebar {
  background: #0f172a;
  color: #fff;
  padding: 24px;
}
.admin-nav {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}
.nav-item {
  display: block;
  padding: 12px 16px;
  border-radius: 10px;
  color: #cbd5e1;
  text-decoration: none;
}
.nav-item.active,
.nav-item:hover {
  background: #1e293b;
  color: #fff;
}
.admin-main {
  padding: 24px;
}
.admin-main .panel {
  background: #ffffff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 20px 50px rgba(15, 23, 42, 0.06);
}
.admin-main .panel h1,
.admin-main .panel h2,
.admin-main .panel h3,
.admin-main .panel h4 {
  color: #0f172a;
}
.admin-main .panel p,
.admin-main .panel label,
.admin-main .panel span,
.admin-main .panel .field-help {
  color: #334155;
}
.group-notice-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px;
  margin: 18px 0 24px;
}
.notice-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  min-height: 90px;
}
.notice-card.notice-active {
  background: #eff6ff;
  border-color: #bfdbfe;
}
.notice-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #0f172a;
}
.notice-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  color: #1d4ed8;
}
.notice-count {
  font-size: 1.5rem;
}
.notice-label {
  font-size: 0.85rem;
  color: #475569;
}
.bell {
  font-size: 1.1rem;
}
.grid-4 {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}
.stat-card {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  padding: 24px;
  border-radius: 16px;
}
.stat-value {
  font-size: 2rem;
  font-weight: 700;
}
.stat-label {
  color: #475569;
}
.filter-form {
  display: grid;
  gap: 12px;
  margin-bottom: 20px;
}
.filter-form input,
.filter-form select {
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}
.filter-row-compact > * {
  flex: 1 1 210px;
  min-width: 160px;
}
.filter-row-compact select,
.filter-row-compact input {
  min-width: 150px;
}
.filter-row-compact button {
  flex: 0 0 auto;
}
.table-wrap {
  overflow-x: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
}
table th,
table td {
  padding: 14px 16px;
  border-bottom: 1px solid #e5e7eb;
  text-align: left;
  font-size: 14px;
  color: #334155;
}
table th {
  background: #f8fafc;
  color: #0f172a;
  font-weight: 700;
}
table tbody tr:hover {
  background: #f8faf9;
}
.row-new {
  background: #f8fafc;
}
.row-replied {
  background: #f0fdf4;
}
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(15, 23, 42, 0.75);
  padding: 16px;
  overflow-y: auto;
  z-index: 2000;
}
.modal-content {
  width: min(520px, 100%);
  background: linear-gradient(180deg, #f8fbff 0%, #eef3fc 100%);
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 40px 90px rgba(15, 23, 42, 0.2);
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-header,
.modal-actions {
  padding: 18px 24px;
}
.modal-header {
  background: linear-gradient(135deg, #2563eb, #3b82f6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h3 {
  margin: 0;
  font-size: 1.35rem;
  letter-spacing: 0.02em;
}
.modal-header button {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.28);
  padding: 10px 16px;
  border-radius: 14px;
  min-width: 100px;
}
.modal-header button:hover {
  background: rgba(255, 255, 255, 0.28);
}
.modal-actions {
  border-top: 1px solid rgba(37, 99, 235, 0.12);
  border-bottom: none;
  background: transparent;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.modal-body {
  padding: 28px;
  overflow-y: auto;
  flex: 1 1 auto;
  min-height: 0;
  max-height: calc(90vh - 150px);
}
.modal-body .form-row {
  margin-bottom: 16px;
}
.modal-body .form-row label {
  color: #475569;
  font-weight: 600;
}
.modal-body .form-row input,
.modal-body .form-row textarea {
  background: #ffffff;
  border-color: #dbeafe;
  color: #0f172a;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}
.modal-body .form-row input:focus,
.modal-body .form-row textarea:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.12);
}
.modal-actions .button {
  flex: 1;
}
.button-secondary {
  background: #e2e8f0;
  color: #0f172a;
  border: 1px solid #cbd5e1;
}
.button-secondary:hover {
  background: #cbd5e1;
}
.modal-actions .button-primary {
  background: #2563eb;
  color: #fff;
  box-shadow: 0 14px 26px rgba(37, 99, 235, 0.22);
}
.modal-actions .button-primary:hover {
  background: #1d4ed8;
}
.attachment-preview {
  margin: 12px 0 20px;
}
.preview-gallery {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
}
.preview-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  align-items: flex-start;
  min-width: 120px;
}
.preview-thumb {
  width: 120px;
  height: 90px;
  object-fit: cover;
  border-radius: 14px;
  border: 1px solid #cbd5e1;
  cursor: pointer;
}
.preview-link {
  color: #2563eb;
  text-decoration: none;
  font-size: 14px;
  word-break: break-all;
}
.preview-download {
  display: inline-flex;
  margin-top: 4px;
}
.preview-empty {
  color: #64748b;
  font-size: 14px;
}
.reply-meta {
  margin: 12px 0 6px;
  color: #0f172a;
  font-weight: 700;
}
.preview-image {
  max-width: 100%;
  border-radius: 14px;
  border: 1px solid #cbd5e1;
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.reply-meta {
  margin: 12px 0 6px;
  color: #0f172a;
  font-weight: 700;
}
.reply-text {
  margin-bottom: 18px;
  padding: 16px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  color: #334155;
  white-space: pre-wrap;
}
@media (max-width: 900px) {
  .admin-layout {
    grid-template-columns: 1fr;
  }
  .sidebar {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
  }
  .grid-4 {
    grid-template-columns: 1fr 1fr;
  }
  .auth-box {
    grid-template-columns: 1fr;
  }
}
@media (max-width: 650px) {
  .grid-4 {
    grid-template-columns: 1fr;
  }
  .filter-row {
    flex-direction: column;
  }
}