* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Arial, Helvetica, sans-serif;
  background: #f3f5f7;
  color: #1f2937;
}

.topbar {
  background: #111827;
  color: white;
  padding: 18px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar h1 {
  margin: 0;
  font-size: 26px;
}

.topbar span { color: #cbd5e1; }

.topbar a {
  color: white;
  text-decoration: none;
  margin-left: 18px;
  font-weight: bold;
}

.container {
  max-width: 1250px;
  margin: 24px auto;
  padding: 0 16px;
}

.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 22px;
}

.stat-card {
  background: white;
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 6px 20px rgba(0,0,0,.07);
}

.stat-card strong {
  display: block;
  font-size: 38px;
}

.stat-card span { color: #64748b; }

.panel {
  background: white;
  border-radius: 14px;
  padding: 22px;
  margin-bottom: 22px;
  box-shadow: 0 6px 20px rgba(0,0,0,.07);
}

.panel h2 { margin-top: 0; }

.grid-form {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  align-items: end;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: bold;
}

input, select, textarea {
  width: 100%;
  padding: 11px;
  border: 1px solid #cbd5e1;
  border-radius: 9px;
  font-size: 15px;
}

textarea { margin: 8px 0 14px; }

button {
  border: 0;
  border-radius: 9px;
  padding: 11px 15px;
  background: #2563eb;
  color: white;
  cursor: pointer;
  font-weight: bold;
}

button:hover { background: #1d4ed8; }
button.danger { background: #dc2626; }
button.danger:hover { background: #b91c1c; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  border-bottom: 1px solid #e5e7eb;
  padding: 10px;
  text-align: left;
  vertical-align: top;
}

th { background: #f8fafc; }

.login-body {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #111827, #1e3a8a);
}

.login-card {
  width: 380px;
  background: white;
  padding: 30px;
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(0,0,0,.25);
}

.login-card h1 { margin-bottom: 5px; }
.login-card p { color: #64748b; margin-top: 0; }

.alert {
  background: #fee2e2;
  color: #991b1b;
  padding: 10px;
  border-radius: 9px;
  margin: 12px 0;
}

.small-note {
  color: #64748b;
  font-size: 13px;
  margin-top: 16px;
}

.inline-form {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: end;
}

hr {
  border: 0;
  border-top: 1px solid #e5e7eb;
  margin: 22px 0;
}

h3 {
  margin-top: 22px;
}

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

.feed-card {
  border: 1px solid #e5e7eb;
  background: #f8fafc;
  border-radius: 14px;
  padding: 16px;
}

.feed-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.feed-title strong {
  font-size: 18px;
}

.checkline {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkline input {
  width: auto;
}

.feed-refresh-form {
  margin-top: -10px;
  margin-bottom: 12px;
}

.button-row {
  display: flex;
  gap: 10px;
  margin-top: 10px;
}

.success {
  background: #dcfce7;
  color: #166534;
  padding: 10px;
  border-radius: 9px;
  margin: 12px 0;
}

.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  background: white;
  border-radius: 14px;
  padding: 12px;
  margin-bottom: 22px;
  box-shadow: 0 6px 20px rgba(0,0,0,.07);
  position: sticky;
  top: 0;
  z-index: 20;
}

.tab-button {
  background: #e5e7eb;
  color: #111827;
  border: 0;
  border-radius: 10px;
  padding: 11px 16px;
  font-weight: bold;
  cursor: pointer;
}

.tab-button:hover {
  background: #cbd5e1;
}

.tab-button.active {
  background: #2563eb;
  color: white;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

.overview-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}

.overview-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 18px;
}

.overview-card strong {
  display: block;
  font-size: 20px;
  margin-bottom: 8px;
}

.overview-card span {
  color: #64748b;
}

@media (max-width: 900px) {
  .overview-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .grid-form {
    grid-template-columns: 1fr;
  }

  .feed-grid {
    grid-template-columns: 1fr;
  }
}

.apps-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.app-card {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 18px;
}

.app-card h3 {
  margin-top: 0;
}

.app-card pre {
  background: #111827;
  color: white;
  padding: 14px;
  border-radius: 10px;
  white-space: pre-wrap;
  word-break: break-word;
}

.button-link {
  display: inline-block;
  background: #2563eb;
  color: white !important;
  text-decoration: none;
  padding: 10px 14px;
  border-radius: 9px;
  font-weight: bold;
}

.button-link:hover {
  background: #1d4ed8;
}

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

.label-hint {
  color: #64748b;
  font-weight: normal;
  font-size: 12px;
}

.days-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  padding: 10px;
  border-radius: 9px;
}

.days-grid label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-weight: normal;
}

.days-grid input {
  width: auto;
}

.edit-box {
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 18px;
}

.secondary-link {
  background: #64748b !important;
}

.mini-btn {
  display: inline-block;
  border: 0;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
  line-height: 1;
  font-weight: bold;
  text-decoration: none;
  cursor: pointer;
  background: #2563eb;
  color: #ffffff !important;
  min-width: 72px;
  text-align: center;
}

.mini-btn:hover {
  background: #1d4ed8;
}

.mini-btn.danger,
button.mini-btn.danger {
  background: #dc2626;
}

.mini-btn.danger:hover,
button.mini-btn.danger:hover {
  background: #b91c1c;
}

.mini-btn.secondary-link {
  background: #64748b !important;
}

.mini-btn.secondary-link:hover {
  background: #475569 !important;
}

.inline-mini-form {
  margin: 0;
}

.inline-mini-form select {
  padding: 7px 8px;
  font-size: 13px;
  min-width: 90px;
}

.group-actions-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

.action-box {
  background: #f8fafc;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 16px;
}

.action-box h4 {
  margin-top: 0;
  margin-bottom: 12px;
}

.action-box select,
.action-box input {
  margin-bottom: 10px;
}

@media (max-width: 900px) {
  .group-actions-grid {
    grid-template-columns: 1fr;
  }
}

.preset-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.preset-buttons form {
  margin: 0;
}

.preset-buttons .mini-btn {
  min-width: 52px;
  padding: 7px 9px;
}

.log-box {
  background: #0f172a;
  color: #e5e7eb;
  padding: 16px;
  border-radius: 12px;
  overflow-x: auto;
  white-space: pre-wrap;
  max-height: 420px;
  font-size: 13px;
}
