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

:root {
  --bg: #f6f8fb;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --ink: #17202a;
  --muted: #64748b;
  --line: #e2e8f0;
  --green: #0f766e;
  --green-dark: #115e59;
  --coral: #f97316;
  --blue: #2563eb;
  --sidebar: #101827;
  --sidebar-soft: #1e293b;
  --danger: #b42318;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --shadow-soft: 0 8px 26px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

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

button,
input,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 336px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 24px;
  min-height: 100vh;
  background: var(--sidebar);
  color: white;
}

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

.brand-icon {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--green), var(--blue));
  box-shadow: 0 12px 26px rgba(37, 99, 235, 0.22);
  font-weight: 800;
  font-size: 25px;
}

.brand-mark h1,
.brand-mark p,
.topbar h2,
.topbar p,
.section-head h3,
.section-head p,
.empty-state h2,
.empty-state p {
  margin: 0;
}

.brand-mark h1 {
  font-size: 23px;
  letter-spacing: 0;
}

.brand-mark p {
  color: rgba(255, 255, 255, 0.72);
  font-size: 13px;
}

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.07);
}

.search-box input {
  width: 100%;
  border: 0;
  outline: 0;
  color: white;
  background: transparent;
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.65);
}

.company-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: auto;
  padding-bottom: 16px;
}

.company-row {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  min-height: 58px;
  padding: 8px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: white;
  background: rgba(255, 255, 255, 0.05);
  text-align: right;
  transition: border-color 160ms ease, background 160ms ease, transform 160ms ease;
}

.company-row.active {
  border-color: rgba(45, 212, 191, 0.42);
  background: rgba(15, 118, 110, 0.24);
}

.company-row:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.1);
}

.company-thumb,
.logo-preview {
  display: grid;
  place-items: center;
  overflow: hidden;
  border-radius: 8px;
  background: white;
  color: var(--green);
  font-weight: 800;
}

.company-thumb {
  width: 42px;
  height: 42px;
  color: var(--blue);
}

.company-thumb img,
.logo-preview img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.company-row strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-row span {
  display: block;
  color: rgba(255, 255, 255, 0.68);
  font-size: 12px;
}

.workspace {
  display: flex;
  flex-direction: column;
  min-width: 0;
  background:
    radial-gradient(circle at 20% 0%, rgba(37, 99, 235, 0.08), transparent 32%),
    linear-gradient(180deg, #f8fafc 0%, #eef3f8 100%);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 92px;
  padding: 22px 34px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.82);
  backdrop-filter: blur(10px);
}

.topbar h2 {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
}

.top-actions,
.segmented-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.primary-button,
.secondary-button,
.ghost-button,
.danger-button {
  min-height: 42px;
  padding: 0 16px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-weight: 700;
  transition: transform 150ms ease, box-shadow 150ms ease, background 150ms ease, border-color 150ms ease;
}

.primary-button {
  background: var(--green);
  color: white;
  box-shadow: 0 10px 22px rgba(15, 118, 110, 0.18);
}

.primary-button:hover {
  background: var(--green-dark);
  transform: translateY(-1px);
}

.secondary-button {
  background: #ecfdf5;
  border-color: #bbf7d0;
  color: var(--green-dark);
}

.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.ghost-button {
  background: white;
  border-color: var(--line);
  color: var(--ink);
}

.danger-button {
  background: #fff5f5;
  border-color: #fecaca;
  color: var(--danger);
}

.full {
  width: 100%;
}

.file-action {
  display: inline-grid;
  place-items: center;
  position: relative;
}

.file-action input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.empty-state {
  display: grid;
  place-items: center;
  align-content: center;
  gap: 16px;
  min-height: calc(100vh - 92px);
  padding: 40px;
  text-align: center;
}

.empty-state p {
  max-width: 520px;
  color: var(--muted);
  line-height: 1.8;
  font-weight: 500;
}

.empty-visual {
  position: relative;
  width: 180px;
  height: 142px;
}

.paper {
  position: absolute;
  width: 108px;
  height: 132px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.paper-a {
  right: 24px;
  top: 8px;
  transform: rotate(-5deg);
}

.paper-b {
  left: 22px;
  top: 18px;
  border-top: 16px solid var(--blue);
  transform: rotate(7deg);
}

.seal {
  position: absolute;
  right: 66px;
  bottom: 8px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--coral);
  box-shadow: 0 10px 24px rgba(214, 107, 69, 0.35);
}

.detail-view {
  padding: 26px 34px 96px;
}

.hidden {
  display: none;
}

.tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 18px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  box-shadow: var(--shadow-soft);
}

.tab {
  min-width: 92px;
  min-height: 40px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.tab.active {
  border-color: #c7d2fe;
  background: white;
  color: var(--ink);
  box-shadow: 0 6px 16px rgba(37, 99, 235, 0.1);
}

.company-form {
  display: block;
}

.tab-panel {
  display: none;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

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

.section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 22px;
}

.compact-head {
  margin-bottom: 14px;
}

.section-head h3 {
  font-size: 23px;
  font-weight: 800;
  letter-spacing: 0;
}

.section-head p,
.document-upload p {
  color: var(--muted);
  line-height: 1.7;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.form-grid.compact {
  gap: 12px;
}

label {
  display: grid;
  gap: 8px;
  color: #3b4246;
  font-size: 14px;
  font-weight: 700;
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--ink);
  outline: 0;
  padding: 12px 13px;
  transition: border-color 150ms ease, box-shadow 150ms ease, background 150ms ease;
}

textarea {
  resize: vertical;
  line-height: 1.7;
}

input:focus,
textarea:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(31, 111, 104, 0.12);
  background: white;
}

.wide-label {
  margin-top: 16px;
}

.identity-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.logo-uploader {
  display: grid;
  gap: 12px;
}

.logo-preview {
  width: 220px;
  aspect-ratio: 1 / 1;
  border: 1px dashed #cbd5e1;
  color: var(--muted);
  background:
    linear-gradient(45deg, #f8fafc 25%, transparent 25%),
    linear-gradient(-45deg, #f8fafc 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #f8fafc 75%),
    linear-gradient(-45deg, transparent 75%, #f8fafc 75%);
  background-color: white;
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.document-upload {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.document-upload h4 {
  margin: 0 0 4px;
}

.asset-preview {
  margin: 14px 0 18px;
  padding: 14px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
}

.asset-preview img {
  display: block;
  max-width: 100%;
  max-height: 320px;
  object-fit: contain;
}

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

.stack {
  display: grid;
  gap: 12px;
}

.content-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.item-card {
  position: relative;
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: var(--shadow-soft);
}

.icon-button {
  position: absolute;
  top: 10px;
  left: 10px;
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--danger);
  font-size: 22px;
  line-height: 1;
}

.company-dialog {
  width: min(520px, calc(100vw - 28px));
  border: 0;
  border-radius: 8px;
  padding: 0;
  background: transparent;
}

.company-dialog::backdrop {
  background: rgba(15, 23, 42, 0.42);
  backdrop-filter: blur(8px);
}

.dialog-panel {
  position: relative;
  display: grid;
  gap: 16px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  box-shadow: 0 24px 70px rgba(15, 23, 42, 0.2);
}

.dialog-head {
  margin-bottom: 0;
  padding-left: 42px;
}

.dialog-close {
  top: 18px;
  left: 18px;
}

.dialog-logo-row {
  display: grid;
  grid-template-columns: 140px minmax(0, 1fr);
  gap: 14px;
  align-items: end;
}

.dialog-logo {
  width: 140px;
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.content-kind {
  justify-self: start;
  min-height: 28px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #eff6ff;
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
}

.content-card img {
  width: 100%;
  max-height: 260px;
  object-fit: contain;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafafa;
}

.identity-gallery-block {
  margin-top: 22px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 12px;
}

.image-tile {
  position: relative;
  overflow: hidden;
  min-height: 150px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  box-shadow: var(--shadow-soft);
}

.image-tile img {
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}

.image-tile .icon-button {
  top: 8px;
  left: 8px;
  background: rgba(255, 255, 255, 0.92);
}

.image-empty {
  display: grid;
  place-items: center;
  min-height: 118px;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}

.save-bar {
  position: fixed;
  right: 336px;
  left: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 72px;
  padding: 12px 32px;
  border-top: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(10px);
}

.save-bar p {
  margin: 0;
  color: var(--muted);
}

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

  .sidebar {
    position: static;
  }

  .company-list {
    max-height: 260px;
  }

  .save-bar {
    right: 0;
  }

  .detail-view,
  .topbar {
    padding-right: 18px;
    padding-left: 18px;
  }

  .identity-layout,
  .form-grid,
  .content-grid {
    grid-template-columns: 1fr;
  }

  .logo-preview {
    width: 100%;
  }
}

@media (max-width: 560px) {
  .topbar,
  .section-head,
  .document-upload,
  .dialog-logo-row,
  .save-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .dialog-logo-row {
    display: grid;
    grid-template-columns: 1fr;
  }

  .dialog-logo {
    width: 100%;
  }

  .tabs {
    overflow-x: auto;
  }

  .tab {
    min-width: 82px;
  }
}
