body {
  font-family: 'Inter', 'Roboto', sans-serif;
  background: #f4f6f8;
  color: #222;
  margin: 0;
}
.panel {
  background: white;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 2rem;
  width: min(70%, 900px);
  margin: 2rem auto;
}
button {
  padding: 0.6rem 1.2rem;
  border-radius: 6px;
  border: none;
  font-size: 1rem;
  cursor: pointer;
}
button.primary { background: #007BFF; color: white; }
button.edit { background: #FF9800; color: white; }
button.delete { background: #F44336; color: white; }
/* ==========
   Layout base
   ========== */

body {
  font-family: 'Inter', 'Roboto', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f4f6f8;
  color: #222;
  margin: 0;
  padding: 0;
  line-height: 1.4;
}

/* Floating UpDuck panel shell */
.panel {
  background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 2rem;
  width: min(70%, 900px);
  max-width: 90%;
  margin: 2rem auto;
  box-sizing: border-box;
}

/* index.php specific wrapper */
.core-index {}

/* ==========
   Headline / intro
   ========== */

.core-header {
  margin-bottom: 1.5rem;
}

.headline {
  font-size: clamp(1.5rem, 1vw + 1rem, 2rem);
  font-weight: 600;
  line-height: 1.2;
  color: #111;
  margin: 0 0 .5rem 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
}

.headline .duck {
  font-size: 1.4em;
  line-height: 1;
}

.lede {
  font-size: 1rem;
  line-height: 1.4;
  color: #444;
  max-width: 50ch;
  margin: 0;
}

/* ==========
   Link button group
   ========== */

.core-links {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin-bottom: 2rem;
}

.btn {
  display: inline-block;
  text-decoration: none;
  background: #ccc;
  color: #fff;
  padding: .6rem 1rem;
  border-radius: .6rem;
  font-size: .9rem;
  font-weight: 500;
  line-height: 1.2;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  border: 0;
  cursor: pointer;
  appearance: none;
}

.btn.primary {
  background: #007BFF;
}

.btn.secondary {
  background: #FF9800;
  color: #fff;
}

.btn.danger {
  background: #F44336;
}

/* We also need "edit" (orange) and default table buttons in admin */
.btn.edit {
  background: #FF9800;
  color: #fff;
}

/* ==========
   Stats cards
   ========== */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(180px,100%),1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  padding: 1rem 1.25rem;
  font-size: 0.9rem;
  line-height: 1.4;
}

.stat-card .label {
  font-size: 0.75rem;
  letter-spacing: .03em;
  text-transform: uppercase;
  color: #555;
  margin-bottom: .4rem;
  font-weight: 600;
}

.stat-card .value {
  font-size: 1.4rem;
  font-weight: 600;
  color: #111;
}

.stat-card .note {
  font-size: .75rem;
  color: #666;
  line-height: 1.3;
}

/* ==========
   Security box
   ========== */

.security-box {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  padding: 1rem 1.25rem;
  font-size: .8rem;
  line-height: 1.4;
  color: #333;
  margin-bottom: 2rem;
}

.security-box h2 {
  font-size: 1rem;
  font-weight: 600;
  margin: 0 0 .5rem 0;
  color: #111;
  line-height: 1.2;
}

.security-box ul {
  margin: 0;
  padding-left: 1.25rem;
}

.security-box li {
  margin-bottom: .4rem;
}

/* ==========
   Footer note
   ========== */

.core-footer {
  font-size: .7rem;
  color: #666;
  text-align: center;
  line-height: 1.4;
}

/* ==========
   Admin dashboard layout
   ========== */

.flex-row-between {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.core-admin-heading {
  display: flex;
  flex-direction: column;
  gap: .25rem;
}

.core-admin-title {
  margin: 0;
  font-size: 1.25rem;
  line-height: 1.2;
  font-weight: 600;
  color: #111;
}

.core-admin-sub {
  color: #666;
  font-size: .8rem;
  line-height: 1.3;
  margin: 0;
}

.core-admin-user {
  color: #222;
  font-size: .8rem;
  line-height: 1.3;
  margin: 0;
}

.logout-link {
  font-size: .8rem;
  color: #F44336;
  text-decoration: none;
  font-weight: 600;
}

/* flash messages */
.flash-success {
  color: #0a0;
  font-weight: 600;
  margin-bottom: 1rem;
  font-size: .9rem;
}

.flash-error {
  color: #c00;
  font-weight: 600;
  margin-bottom: .5rem;
  font-size: .9rem;
}

/* section headers */
.section-block {
  margin-bottom: 3rem;
}

.panel-header {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: .5rem;
  margin-bottom: 1rem;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.1rem;
  line-height: 1.2;
  font-weight: 600;
  color: #111;
}

.panel-header .desc {
  font-size: .8rem;
  color: #666;
  line-height: 1.3;
}

/* stat grid in admin top section reuses .stat-grid, .stat-card */

/* tables */
.core-table {
  border-collapse: collapse;
  width: 100%;
  max-width: 100%;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,0.06);
  margin-bottom: 2rem;
  font-size: 0.9rem;
}

.core-table th {
  background: #f0f2f5;
  text-align: left;
  padding: 0.6rem;
  font-weight: 600;
  border-bottom: 1px solid #ddd;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  line-height: 1.2;
}

.core-table td {
  padding: 0.6rem;
  border-bottom: 1px solid #eee;
  vertical-align: top;
  word-break: break-word;
  line-height: 1.3;
  font-size: .85rem;
  color: #222;
}

.core-table tr:last-child td {
  border-bottom: none;
}

.core-table .muted {
  color: #666;
  font-size: .75rem;
  line-height: 1.3;
}

/* tenant create form row */
.tenant-form {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  align-items: flex-end;
  margin-bottom: 1rem;
}

.form-block {
  display: flex;
  flex-direction: column;
  flex: 1 1 200px;
}

.form-block-small {
  display: flex;
  flex-direction: column;
  flex: 0 0 140px;
}

.form-label {
  display: block;
  font-size: .8rem;
  font-weight: 600;
  color: #111;
  margin-bottom: .25rem;
  line-height: 1.2;
}

.form-input,
.form-select {
  width: 100%;
  padding: .5rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: .9rem;
  line-height: 1.2;
  box-sizing: border-box;
  background: #fff;
  color: #222;
}

/* inline forms in table cells (e.g. regen API key) */
.inline-form {
  display: inline;
  margin: 0;
  padding: 0;
}

/* footer note in admin */
.admin-footer-note {
  font-size: .7rem;
  margin-top: 3rem;
  color: #666;
  text-align: center;
  line-height: 1.4;
}

/* login screen layout */
.login-wrapper {
  max-width: 360px;
  width: 90%;
  margin: 4rem auto;
  background: #fff;
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  border-radius: 12px;
  padding: 2rem;
  box-sizing: border-box;
}

.login-title {
  margin: 0 0 1rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: #111;
  line-height: 1.2;
  text-align: center;
}

.login-error {
  color: #c00;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: 1rem;
  text-align: center;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.login-input {
  width: 100%;
  padding: .6rem .7rem;
  border-radius: 6px;
  border: 1px solid #ccc;
  font-size: .9rem;
  line-height: 1.2;
  background: #fff;
  color: #222;
  box-sizing: border-box;
}

.login-submit {
  display: inline-block;
  width: 100%;
  text-align: center;
  background: #007BFF;
  color: #fff;
  font-weight: 500;
  font-size: .9rem;
  line-height: 1.2;
  border-radius: 6px;
  padding: .7rem 1rem;
  border: 0;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(0,0,0,0.12);
  appearance: none;
}
