:root {
  color-scheme: light;
  --page: #edf2f1;
  --surface: #ffffff;
  --text: #162421;
  --muted: #61706d;
  --line: #d5dfdc;
  --brand: #176b5b;
  --brand-dark: #105044;
  --accent: #d7a53a;
  font-family: Arial, "Noto Sans Hebrew", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--page);
  color: var(--text);
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.hidden {
  display: none !important;
}

.login-screen {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 20px;
}

.login-panel {
  display: grid;
  gap: 16px;
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: 0 16px 38px rgba(23, 48, 43, 0.12);
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-size: 1.5rem;
  font-weight: 800;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 5px;
  font-size: 1.75rem;
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--brand);
  font-size: 0.78rem;
  font-weight: 800;
}

.login-copy,
.form-message,
.muted {
  color: var(--muted);
}

label {
  display: grid;
  gap: 6px;
  color: #33433f;
  font-size: 0.88rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 44px;
  padding: 9px 11px;
  border: 1px solid #b9c8c4;
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

input:focus {
  border-color: var(--brand);
  outline: 3px solid rgba(23, 107, 91, 0.14);
}

.primary-button,
.text-button,
.project-tab {
  min-height: 42px;
  padding: 9px 14px;
  border-radius: 6px;
  font-weight: 800;
}

.primary-button {
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
}

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

.text-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.form-message {
  min-height: 1.2em;
  margin: 0;
  font-size: 0.86rem;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px max(20px, calc((100% - 1180px) / 2));
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.topbar h1 {
  margin: 0;
  font-size: 1.45rem;
}

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

.workspace {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 40px;
}

.project-tabs {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  overflow-x: auto;
}

.project-tab {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--text);
}

.project-tab.active {
  border-color: var(--brand);
  background: var(--brand);
  color: #fff;
}

.project-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  padding: 4px 0 18px;
}

.project-header h2 {
  margin-bottom: 5px;
}

.expense-total {
  min-width: 180px;
  padding: 12px 14px;
  border-right: 4px solid var(--brand);
  background: #fff;
}

.expense-total span,
.expense-total strong {
  display: block;
}

.expense-total span {
  color: var(--muted);
  font-size: 0.82rem;
}

.expense-total strong {
  margin-top: 3px;
  font-size: 1.35rem;
}

.section-band {
  margin-top: 16px;
  padding: 18px 0;
  border-top: 1px solid var(--line);
}

.section-band > h3 {
  margin-bottom: 12px;
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  background: #f4f7f6;
  color: #43534f;
  font-size: 0.82rem;
}

tr:last-child td {
  border-bottom: 0;
}

.media-folder {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.media-folder summary {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 13px 14px;
  cursor: pointer;
  font-weight: 800;
  list-style: none;
}

.media-folder summary::-webkit-details-marker {
  display: none;
}

.folder-symbol {
  position: relative;
  display: inline-block;
  width: 31px;
  height: 22px;
  border-radius: 3px;
  background: var(--accent);
}

.folder-symbol::before {
  position: absolute;
  top: -5px;
  right: 3px;
  width: 14px;
  height: 7px;
  border-radius: 3px 3px 0 0;
  background: #e4b64f;
  content: "";
}

.media-folder-count {
  margin-right: auto;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 400;
}

.image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 10px;
  padding: 0 12px 14px;
}

.image-item {
  display: grid;
  gap: 7px;
  min-width: 0;
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
}

.image-button {
  display: grid;
  width: 100%;
  aspect-ratio: 4 / 3;
  place-items: center;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-radius: 5px;
  background: #e7edeb;
  color: var(--muted);
}

.image-button img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.image-item strong,
.image-item small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.image-item small {
  color: var(--muted);
}

.empty-state {
  padding: 22px;
  color: var(--muted);
  text-align: center;
}

.image-dialog {
  width: min(1000px, calc(100% - 20px));
  max-height: calc(100vh - 20px);
  padding: 12px;
  border: 0;
  border-radius: 8px;
  background: #101816;
  color: #fff;
}

.image-dialog::backdrop {
  background: rgba(0, 0, 0, 0.78);
}

.image-dialog img {
  display: block;
  width: 100%;
  max-height: calc(100vh - 110px);
  object-fit: contain;
}

.close-button {
  position: absolute;
  top: 18px;
  left: 18px;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #111;
  font-size: 1.4rem;
}

.image-dialog p {
  margin: 8px 3px 0;
  overflow-wrap: anywhere;
}

@media (max-width: 640px) {
  .login-panel {
    padding: 22px 18px;
  }

  .topbar,
  .project-header {
    align-items: stretch;
    flex-direction: column;
  }

  .workspace {
    width: min(100% - 20px, 1180px);
  }

  .expense-total {
    min-width: 0;
  }

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