@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Sans+Arabic:wght@400;500;600;700&display=swap');

:root {
  --ink: #263238;
  --muted: #6e7a80;
  --line: #e5e9e7;
  --line-strong: #cbd7d3;
  --paper: #ffffff;
  --bg: #f6f7f5;
  --accent: #38665d;
  --accent-dark: #2d514a;
  --warm: #b98a57;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: "IBM Plex Sans Arabic", Tahoma, Arial, sans-serif;
  line-height: 1.7;
}

.topbar {
  min-height: 76px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 12px max(calc((100% - 1140px) / 2), 24px);
  flex-wrap: wrap;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  font-weight: 700;
  font-size: 17px;
  white-space: nowrap;
}

.topbar nav {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  align-items: center;
}

.topbar nav a {
  color: #58645f;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  padding: 4px 0;
  white-space: nowrap;
}

.topbar nav a:hover,
.topbar nav a.active,
.back-link:hover {
  color: var(--accent);
}

.topbar nav a.active {
  border-bottom: 2px solid var(--accent);
}

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

.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 0 24px;
  min-height: calc(100vh - 185px);
}

.hero {
  padding: 64px 0 46px;
  text-align: center;
}

.eyebrow,
.kicker {
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
}

.hero h1 {
  font-size: clamp(32px, 5vw, 50px);
  font-weight: 500;
  letter-spacing: -0.5px;
  margin: 10px 0 8px;
}

.hero h1 em {
  font-style: normal;
  color: var(--accent);
}

.hero > p {
  color: var(--muted);
  font-size: 14px;
  margin: 0 auto;
  max-width: 560px;
}

.hero-rule {
  height: 1px;
  width: 52px;
  background: var(--line-strong);
  margin: 28px auto 0;
}

.section-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 22px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}

.section-head h1,
.section-head h2 {
  font-size: 24px;
  margin: 2px 0 0;
  font-weight: 600;
}

.section-head p {
  margin: 4px 0 0;
  font-size: 12px;
  color: var(--muted);
}

.count {
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--muted);
  padding: 5px 12px;
  font-size: 11px;
  white-space: nowrap;
}

.subject-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 60px;
}

.subject-card {
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 22px 22px 16px;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: border-color 0.2s, transform 0.2s;
}

.subject-card:hover {
  border-color: #93b0a6;
  transform: translateY(-2px);
}

.subject-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.subject-icon {
  font-size: 11px;
  color: var(--accent);
  background: #eef3f0;
  padding: 4px 8px;
  font-weight: 600;
}

.arrow {
  color: #9ba6a1;
  font-size: 18px;
}

.subject-card h3 {
  font-size: 18px;
  margin: 14px 0 4px;
  font-weight: 600;
}

.subject-card p {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 20px;
}

.card-bottom {
  border-top: 1px solid #eff1f2;
  padding-top: 12px;
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 11px;
}

.card-bottom span:last-child {
  color: var(--accent);
  font-weight: 600;
}

footer {
  text-align: center;
  padding: 26px 20px 32px;
  color: var(--muted);
  font-size: 12px;
  border-top: 1px solid var(--line);
  background: #ffffff;
}

footer p {
  margin: 0;
  color: #58645f;
}

footer strong {
  color: var(--accent);
}

footer small {
  display: block;
  margin-top: 4px;
  font-size: 11px;
}

.empty {
  text-align: center;
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 48px 20px;
  margin-bottom: 50px;
}

.empty h3 {
  margin: 0;
  font-size: 16px;
}

.empty p,
.hint {
  color: var(--muted);
  font-size: 12px;
}

.btn {
  border: 0;
  padding: 10px 18px;
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  display: inline-block;
  text-decoration: none;
  text-align: center;
}

.primary {
  background: var(--accent);
  color: #ffffff;
}

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

.secondary {
  background: #edf1ef;
  color: var(--accent);
}

.full {
  width: 100%;
  margin-top: 16px;
}

.breadcrumbs {
  display: flex;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  margin: 24px 0 18px;
}

.breadcrumbs a {
  color: var(--accent);
  text-decoration: none;
}

.page-intro {
  padding: 10px 0 24px;
}

.page-intro h1 {
  font-size: 30px;
  margin: 4px 0;
  font-weight: 600;
}

.page-intro p {
  font-size: 13px;
  color: var(--muted);
  margin: 0;
}

.file-list {
  background: #ffffff;
  border: 1px solid var(--line);
  margin-bottom: 28px;
}

.file-row {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 15px 20px;
  border-bottom: 1px solid #eef0f1;
}

.file-row:last-child {
  border-bottom: 0;
}

.file-type {
  width: 44px;
  height: 48px;
  background: #eef3f0;
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 10px;
  font-weight: 700;
  flex-shrink: 0;
}

.file-info {
  flex: 1;
  min-width: 0;
}

.file-info strong {
  display: block;
  font-size: 14px;
}

.file-info small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.download {
  font-size: 12px;
  color: var(--accent);
  text-decoration: none;
  border: 1px solid #dce5e1;
  padding: 7px 13px;
  white-space: nowrap;
  background: #ffffff;
}

.download:hover {
  border-color: var(--accent);
  background: #eef3f0;
}

.download.solid {
  background: var(--accent);
  color: #ffffff;
  border-color: var(--accent);
}

.back-link {
  display: inline-block;
  color: #58645f;
  text-decoration: none;
  font-size: 12px;
  margin: 10px 0 40px;
}

.auth-wrap {
  display: grid;
  place-items: center;
  padding: 60px 0;
}

.auth-card {
  width: min(100%, 420px);
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 32px;
}

.auth-card h1 {
  font-size: 23px;
  margin: 4px 0 6px;
}

.auth-card > p {
  font-size: 12px;
  color: var(--muted);
  margin: 0 0 12px;
}

form label {
  display: block;
  font-size: 12px;
  margin: 12px 0 5px;
  color: #58645f;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid #dfe4e2;
  background: #ffffff;
  padding: 10px 12px;
  font: inherit;
  font-size: 12px;
  color: var(--ink);
  outline: none;
  border-radius: 0;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
}

.messages {
  padding-top: 16px;
}

.alert {
  padding: 10px 14px;
  font-size: 12px;
  margin-bottom: 8px;
  border: 1px solid transparent;
}

.alert.success {
  background: #eef5f2;
  color: #2f6b55;
  border-color: #cde0d8;
}

.alert.error {
  background: #fbefed;
  color: #a03c32;
  border-color: #ebd0cc;
}

/* Announcements Chat */
.chat-box {
  background: #ffffff;
  border: 1px solid var(--line);
  margin-bottom: 40px;
}

.chat-header {
  padding: 12px 20px;
  background: #fafbfa;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--muted);
}

.chat-stream {
  padding: 20px;
  background: #f9faf9;
  max-height: 560px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.chat-msg {
  max-width: 780px;
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 16px 18px;
}

.chat-msg-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-bottom: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid #f0f2f1;
  font-size: 12px;
}

.chat-msg-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.chat-msg-body {
  font-size: 14px;
  white-space: pre-wrap;
  margin: 0;
}

.chat-msg-attach {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #f0f2f1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}

.priority-urgent {
  color: #a03c32;
  font-weight: 600;
}

.priority-important {
  color: #9c5718;
  font-weight: 600;
}

.chat-composer {
  border-top: 1px solid var(--line);
  padding: 18px 20px;
  background: #ffffff;
}

.toolbar-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}

.tab-group {
  display: inline-flex;
  border: 1px solid var(--line);
  background: #ffffff;
  padding: 2px;
  flex-wrap: wrap;
}

.tab-btn {
  padding: 6px 12px;
  font-size: 12px;
  text-decoration: none;
  color: #58645f;
}

.tab-btn.active {
  background: var(--accent);
  color: #ffffff;
}

/* Schedule Grid (4 Days Only) */
.schedule-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  margin-bottom: 45px;
}

.schedule-grid.single {
  grid-template-columns: 1fr;
}

.day-card {
  background: #ffffff;
  border: 1px solid var(--line);
}

.day-head {
  padding: 14px 18px;
  background: #fafbfa;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.day-head h2 {
  font-size: 16px;
  margin: 0;
}

.day-row {
  padding: 14px 18px;
  border-bottom: 1px solid #eef0f1;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.day-row:last-child {
  border-bottom: 0;
}

.day-row h3 {
  font-size: 14px;
  margin: 0 0 4px;
}

.day-row-meta {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

/* Tables & Preview */
.preview-panel {
  background: #ffffff;
  border: 1px solid var(--line-strong);
  margin-bottom: 40px;
}

.preview-head {
  padding: 14px 20px;
  background: #fafbfa;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.preview-body {
  padding: 20px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  max-height: 520px;
}

table.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
  text-align: right;
}

table.data-table th {
  background: #eef3f0;
  color: var(--ink);
  padding: 10px 12px;
  border-bottom: 1px solid #dce5e1;
  position: sticky;
  top: 0;
  white-space: nowrap;
}

table.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid #eef0f1;
  white-space: nowrap;
}

/* Admin */
.admin-heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 36px 0 20px;
}

.admin-heading h1 {
  font-size: 28px;
  margin: 4px 0;
}

.admin-tag {
  font-size: 11px;
  color: var(--accent);
  border: 1px solid #d3dfda;
  background: #ffffff;
  padding: 5px 12px;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

.panel {
  background: #ffffff;
  border: 1px solid var(--line);
  padding: 22px;
  margin-bottom: 15px;
}

.panel-title {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
}

.number {
  font-size: 11px;
  color: #77838a;
  border-left: 1px solid #dce5e1;
  padding-left: 12px;
}

.panel-title h2 {
  font-size: 16px;
  margin: 0;
}

.panel-title p {
  font-size: 11px;
  color: var(--muted);
  margin: 2px 0 0;
}

.panel form .btn {
  margin-top: 14px;
}

.manage-list {
  border-top: 1px solid var(--line);
}

.manage-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 0;
  border-bottom: 1px solid #eff1f2;
}

.manage-row > div {
  flex: 1;
  min-width: 0;
}

.manage-row strong {
  display: block;
  font-size: 12px;
}

.manage-row small {
  display: block;
  font-size: 11px;
  color: var(--muted);
}

.small-link,
.text-danger {
  font-size: 11px;
  text-decoration: none;
  color: var(--accent);
  background: none;
  border: 0;
  cursor: pointer;
  font-family: inherit;
}

.text-danger {
  color: #a03c32;
}

.password-form {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.password-form > div {
  flex: 1;
  min-width: 180px;
}

.folder-note {
  background: #eef3f0;
  border: 1px solid #d3dfda;
  padding: 16px 18px;
  margin: 5px 0 45px;
  font-size: 12px;
  color: #58645f;
}

.folder-note code {
  direction: ltr;
  display: inline-block;
  background: #ffffff;
  padding: 1px 6px;
  color: var(--accent);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

@media (max-width: 780px) {
  .subject-grid,
  .admin-grid,
  .schedule-grid,
  .grid-2,
  .grid-3 {
    grid-template-columns: 1fr;
  }

  .file-row {
    flex-wrap: wrap;
  }

  .row-actions {
    width: 100%;
    justify-content: flex-end;
  }
}
