/* ===== Tông màu sáng, xanh lá kiểu Ghibli ===== */
:root {
  --bg: #f3f7ec;          /* kem ngả xanh nhạt */
  --bg-2: #e9f1dc;        /* nền phụ */
  --panel: #ffffff;       /* thẻ */
  --panel-soft: #f6faef;  /* nền input */
  --text: #38452f;        /* xanh rêu đậm cho chữ */
  --muted: #7c8b6a;       /* chữ phụ */
  --primary: #6fae5f;     /* xanh lá cây lá non */
  --primary-hover: #5b9a4d;
  --primary-soft: #e3f0d6;
  --accent: #e8b24c;      /* vàng nắng Ghibli (điểm nhấn) */
  --sky: #bfe0d8;         /* xanh ngọc nhạt */
  --green: #5aa469;
  --red: #d2694f;         /* đỏ gạch dịu */
  --yellow: #e0a63a;
  --border: #d7e4c5;      /* viền xanh nhạt */
  --radius: 16px;
  --shadow: 0 6px 20px rgba(90, 130, 70, 0.10);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  color: var(--text);
  line-height: 1.55;
  /* nền gradient mềm gợi bầu trời/đồng cỏ Ghibli */
  background:
    radial-gradient(1200px 500px at 110% -10%, #d8ecc5 0%, transparent 60%),
    radial-gradient(900px 400px at -10% 0%, #cfe8df 0%, transparent 55%),
    var(--bg);
  background-attachment: fixed;
  min-height: 100vh;
}

a { color: var(--primary-hover); }

.muted { color: var(--muted); }
.error { color: var(--red); margin: 8px 0 0; }
.ok { color: var(--green); }

/* ===== Auth ===== */
.auth-body {
  display: flex;
  min-height: 100vh;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.auth-card { width: 100%; max-width: 370px; text-align: center; }
.auth-card h1 { margin: 0 0 4px; font-size: 26px; }
.auth-card label { text-align: left; }

/* ===== Layout ===== */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.75);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 10;
}
.topbar h1 { font-size: 18px; margin: 0; letter-spacing: 0.2px; }
.topbar .right { display: flex; align-items: center; gap: 10px; }

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  gap: 16px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow);
}
.card h2 {
  margin: 0 0 14px;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Form in dàn ngang: nhiều cột tự co giãn, tự xuống dòng -> giảm chiều cao */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  align-items: end;
  margin-bottom: 16px;
}
.form-grid > label { margin-bottom: 0; }
/* form-grid trong phần nâng cao không cần margin dưới (đã có hint phía sau) */
.advanced .form-grid { margin-bottom: 8px; }
/* Trường chiếm trọn chiều rộng (chọn file, raw options) */
.form-grid > .col-wide { grid-column: 1 / -1; }
@media (min-width: 720px) {
  .form-grid > .col-wide { grid-column: span 2; }
}

.form-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  margin-top: 16px;
}
.form-footer .hint { margin: 0; margin-right: auto; }
.form-footer .btn-primary { width: auto; min-width: 160px; }

/* ===== Form ===== */
label {
  display: block;
  margin-bottom: 12px;
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
input, select {
  width: 100%;
  margin-top: 5px;
  padding: 10px 12px;
  background: var(--panel-soft);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 14px;
  font-weight: 400;
}
input:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.row { display: flex; gap: 12px; }
.row > label { flex: 1; }

.checkbox-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.checkbox-row input { width: auto; margin: 0; }

/* ===== Buttons ===== */
.btn {
  display: inline-block;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--panel-soft);
  color: var(--text);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.15s, transform 0.05s;
}
.btn:hover { background: var(--bg-2); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  width: 100%;
  padding: 12px;
  font-size: 15px;
}
.btn-primary:hover { background: var(--primary-hover); }
.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-danger { color: var(--red); border-color: #ecc9bf; }
.btn-danger:hover { background: #f7e7e1; }

/* ===== Banner trạng thái ===== */
.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  border-radius: var(--radius);
  font-size: 14px;
  box-shadow: var(--shadow);
}
.banner.online  { background: var(--primary-soft); border: 1px solid var(--primary); }
.banner.offline { background: #fbf1d7; border: 1px solid var(--accent); }

.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }
.dot.green  { background: var(--green); box-shadow: 0 0 0 4px rgba(90,164,105,0.2); }
.dot.yellow { background: var(--yellow); box-shadow: 0 0 0 4px rgba(224,166,58,0.2); }
.dot.red    { background: var(--red); }

/* ===== Dải thống kê gọn (một hàng ngang, nhỏ) ===== */
.stat-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.stat-chip {
  flex: 1 1 0;
  min-width: 110px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  box-shadow: var(--shadow);
}
.stat-chip .ic { font-size: 18px; line-height: 1; }
.stat-chip .num { font-size: 20px; font-weight: 700; }
.stat-chip .label { font-size: 12px; color: var(--muted); }

/* ===== Table ===== */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; text-transform: uppercase; letter-spacing: 0.3px; }
td .filename { font-weight: 600; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: var(--panel-soft); }

/* ===== Status pills ===== */
.pill {
  display: inline-block;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
}
.pill.queued   { background: #eef1e8; color: #6f7d5c; }
.pill.sent     { background: var(--sky); color: #357a6b; }
.pill.printing { background: #fbeecb; color: #b2822a; }
.pill.done     { background: var(--primary-soft); color: #3f7d33; }
.pill.failed   { background: #f6ddd4; color: #b4553c; }
.pill.canceled { background: #eef1e8; color: #98a487; }

.tabs { display: flex; gap: 6px; margin-bottom: 12px; }
.tab {
  cursor: pointer;
  padding: 7px 16px;
  border-radius: 999px;
  color: var(--muted);
  font-weight: 600;
  font-size: 13px;
}
.tab.active { background: var(--primary-soft); color: var(--primary-hover); }

.hint { font-size: 12px; color: var(--muted); margin-top: 4px; font-weight: 400; }

/* ===== Tuỳ chọn nâng cao ===== */
.advanced {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 14px;
  margin-bottom: 14px;
  background: var(--panel-soft);
}
.advanced > summary {
  cursor: pointer;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  user-select: none;
}
.advanced[open] > summary { margin-bottom: 12px; color: var(--text); }
code {
  background: var(--bg-2);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 12px;
}
