:root {
  --bg: #f6f7fb;
  --card: #ffffff;
  --text: #111827;
  --muted: #667085;
  --line: #e6e9f0;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #16a34a;
}

* {
  box-sizing: border-box;
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Tajawal", "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 16px;
  font-weight: 400;
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  background: var(--primary);
  border: 0;
  border-radius: 8px;
  color: #fff;
  cursor: pointer;
  font-weight: 700;
  padding: 12px 16px;
}

button:hover {
  background: var(--primary-dark);
}

button.secondary,
.row-actions button.secondary {
  background: #eef2ff;
  color: var(--primary);
}

button.secondary:hover,
.row-actions button.secondary:hover {
  background: #dbeafe;
}

button.danger,
.row-actions button.danger {
  background: #dc2626;
}

button.danger:hover,
.row-actions button.danger:hover {
  background: #b91c1c;
}

.login {
  display: grid;
  grid-template-columns: minmax(320px, 520px) 1fr;
  min-height: 100vh;
}

.login-card {
  align-self: center;
  justify-self: center;
  max-width: 420px;
  padding: 36px;
  width: 100%;
}

.brand {
  align-items: center;
  display: flex;
  gap: 12px;
}

.brand span {
  align-items: center;
  background: var(--primary);
  border-radius: 12px;
  color: #fff;
  display: inline-flex;
  font-size: 15px;
  font-weight: 800;
  height: 52px;
  justify-content: center;
  width: 52px;
}

.brand strong {
  font-size: 23px;
  font-weight: 800;
  line-height: 1.25;
}

.login h1 {
  font-size: 36px;
  font-weight: 800;
  letter-spacing: 0;
  line-height: 1.25;
  margin: 34px 0 8px;
}

.login p {
  color: var(--muted);
  line-height: 1.8;
}

form {
  display: grid;
  gap: 14px;
}

label {
  color: var(--muted);
  display: grid;
  gap: 8px;
}

input,
select {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  min-height: 46px;
  padding: 10px 12px;
}

small {
  color: var(--muted);
  display: inline-block;
  font-size: 12px;
  margin-top: 4px;
}

form small {
  color: #dc2626;
  min-height: 18px;
}

.accounts {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  display: grid;
  gap: 8px;
  margin-top: 24px;
  padding: 14px;
}

.accounts button {
  align-items: center;
  background: #f8fafc;
  color: var(--text);
  display: flex;
  justify-content: space-between;
}

.accounts code {
  color: var(--primary);
}

.login-art {
  align-items: center;
  background: linear-gradient(135deg, #0f172a, #2563eb);
  display: flex;
  justify-content: center;
}

.device {
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 28px;
  color: #fff;
  display: grid;
  gap: 16px;
  min-width: 320px;
  padding: 32px;
}

.device div {
  background: rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  height: 42px;
}

.device strong {
  font-size: 48px;
}

.shell {
  display: grid;
  grid-template-columns: 260px 1fr;
  min-height: 100vh;
}

aside {
  background: #fff;
  border-left: 1px solid var(--line);
  padding: 24px;
}

nav {
  display: grid;
  gap: 8px;
  margin-top: 28px;
}

nav a {
  border-radius: 8px;
  color: var(--muted);
  font-size: 16px;
  font-weight: 500;
  padding: 12px;
  text-decoration: none;
}

nav a.active,
nav a:hover {
  background: #eff6ff;
  color: var(--primary);
  font-weight: 700;
}

main {
  padding: 28px;
}

header {
  align-items: center;
  display: flex;
  justify-content: space-between;
  margin-bottom: 24px;
}

header h2 {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.25;
  margin: 0 0 6px;
}

header p {
  color: var(--muted);
  margin: 0;
}

.stats {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.stats article,
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.stats span {
  color: var(--muted);
}

.stats strong {
  display: block;
  font-size: 30px;
  margin-top: 8px;
}

.card {
  margin-bottom: 18px;
}

.card h3 {
  font-size: 20px;
  font-weight: 800;
  line-height: 1.35;
  margin: 0 0 16px;
}

.grid-form {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin-bottom: 12px;
}

.form-wide {
  grid-column: 1 / -1;
}

.field-title {
  color: var(--muted);
  display: block;
  font-weight: 700;
  margin-bottom: 8px;
}

.day-picker {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(7, minmax(0, 1fr));
}

.day-option {
  display: block;
  min-width: 0;
  position: relative;
}

.day-option input {
  opacity: 0;
  position: absolute;
}

.day-option span {
  align-items: center;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  font-weight: 700;
  justify-content: center;
  min-height: 46px;
  padding: 10px 8px;
  text-align: center;
  transition: 0.15s ease;
  width: 100%;
}

.day-option input:checked + span {
  background: #eff6ff;
  border-color: var(--primary);
  color: var(--primary);
}

.day-option input:focus-visible + span {
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}

.filters,
.section-head,
.row-actions,
.settings-actions {
  align-items: center;
  display: flex;
  gap: 10px;
}

.filters,
.settings-actions {
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.filters input,
.filters select {
  min-width: 180px;
}

.section-head {
  justify-content: space-between;
  margin-bottom: 14px;
}

.section-head h3 {
  margin: 0;
}

.row-actions {
  min-width: 150px;
}

.row-actions button {
  border-radius: 7px;
  font-size: 13px;
  padding: 7px 10px;
  white-space: nowrap;
}

.table-wrap {
  max-height: 560px;
  overflow-x: auto;
  overflow-y: auto;
}

table {
  border-collapse: collapse;
  min-width: 760px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 13px;
  text-align: right;
}

th {
  background: var(--card);
  color: var(--muted);
  font-size: 15px;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

td {
  font-size: 15px;
  font-weight: 500;
}

.tag {
  background: #ecfdf5;
  border-radius: 999px;
  color: var(--success);
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  padding: 5px 10px;
}

.muted {
  color: var(--muted);
  line-height: 1.8;
  margin: 0;
}

.import-result {
  background: #f8fafc;
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  display: grid;
  gap: 6px;
  margin-top: 12px;
  min-height: 44px;
  padding: 12px;
}

.import-result strong {
  color: var(--text);
}

.import-result ul {
  margin: 4px 18px 0 0;
}

.error-text {
  color: #dc2626 !important;
}

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

  .login-art {
    display: none;
  }

  aside {
    border-bottom: 1px solid var(--line);
    border-left: 0;
  }

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

  .day-picker {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
