*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --bg: #f7f3ed;
  --surface: #efe9df;
  --card: #fdfaf6;
  --border: #ddd3c0;
  --border2: #c9bca6;
  --accent: #7a4f2d;
  --accent-light: #b8896a;
  --accent-dark: #4a2d17;
  --accent-muted: #c9a882;
  --text: #2a2018;
  --text-muted: #7a6a58;
  --text-hint: #a89880;
  --success: #4a7c59;
  --success-bg: #eaf4ee;
  --success-border: #b8d9c4;
  --warn: #8a6218;
  --warn-bg: #fdf5e0;
  --warn-border: #e0cc88;
  --danger: #8b3228;
  --danger-bg: #fbeae8;
  --danger-border: #e8c0bb;
  --modal-bg: rgba(30, 20, 12, 0.55);
  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 2px 16px rgba(80, 50, 20, 0.1);
}

body {
  font-family: "DM Sans", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3 {
  font-family: "Cormorant Garamond", serif;
  font-weight: 400;
}

button {
  cursor: pointer;
  font-family: inherit;
}

input,
textarea,
select {
  font-family: inherit;
}

/* ── Boot (ilk açılış) ── */
.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background: var(--bg);
}

.boot-text {
  font-size: 14px;
  color: var(--text-muted);
}

/* ── Login ── */
#login-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.login-eyebrow {
  font-size: 10px;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-muted);
  margin-bottom: 8px;
  text-align: center;
}

.login-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 36px;
  font-weight: 300;
  color: var(--accent-dark);
  text-align: center;
  margin-bottom: 4px;
  letter-spacing: -0.5px;
}

.login-italic {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: 15px;
  color: var(--text-muted);
  text-align: center;
  margin-bottom: 32px;
}

.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: var(--shadow);
}

.field {
  margin-bottom: 16px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.4px;
  margin-bottom: 5px;
}

.field input {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.field input:focus {
  border-color: var(--accent-light);
}

.login-error {
  font-size: 13px;
  color: var(--danger);
  margin-bottom: 12px;
  text-align: center;
}

.btn-primary {
  width: 100%;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: "Cormorant Garamond", serif;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.2s;
}

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

/* ── App ── */
#app {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#header {
  position: sticky;
  top: 0;
  z-index: 90;
  background: var(--card);
  border-bottom: 1px solid var(--border);
}

.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px 0;
}

.header-brand .eyebrow {
  font-size: 10px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--accent-muted);
}

.header-brand .name {
  font-family: "Cormorant Garamond", serif;
  font-size: 18px;
  color: var(--accent-dark);
  font-weight: 400;
  font-style: italic;
  line-height: 1.2;
}

.header-user {
  text-align: right;
}

.header-user .uname {
  font-size: 12px;
  color: var(--text-muted);
}

.btn-logout {
  font-size: 11px;
  color: var(--accent);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.sync-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  margin-left: 6px;
  vertical-align: middle;
}

.sync-dot.off {
  background: var(--text-hint);
}

.demo-banner {
  text-align: center;
  font-size: 11px;
  letter-spacing: 0.04em;
  padding: 8px 12px;
  background: var(--warn-bg);
  color: var(--warn);
  border-bottom: 1px solid var(--warn-border);
}

.nav-tabs {
  display: flex;
  gap: 4px;
  padding: 10px 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.nav-tabs::-webkit-scrollbar {
  display: none;
}

.nav-tab {
  flex-shrink: 0;
  padding: 7px 16px;
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
  background: transparent;
  color: var(--text-muted);
}

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

.nav-tab:not(.active):hover {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}

#page {
  flex: 1;
  padding: 16px;
}

/* ── Footer ── */
.app-footer {
  padding: 10px 16px 16px;
  text-align: center;
  font-size: 11px;
  color: var(--text-hint);
}

.app-footer::before {
  content: "";
  display: block;
  height: 1px;
  background: var(--border);
  margin: 0 16px 10px;
}

.footer-copy {
  display: block;
}

.footer-powered {
  margin-top: 6px;
}

.footer-klikdex {
  color: #d44028;
  font-weight: 800;
}

/* ── Loading ── */
.loading {
  text-align: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  font-size: 14px;
}

.spinner {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  margin: 0 auto 12px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ── Room strip ── */
.room-strip {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 14px;
  scrollbar-width: none;
}

.room-strip::-webkit-scrollbar {
  display: none;
}

.room-btn {
  flex-shrink: 0;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 13px;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}

.room-btn.active {
  background: var(--accent-dark);
  color: #fff;
  border-color: var(--accent-dark);
}

.room-badge {
  font-size: 11px;
  opacity: 0.75;
  margin-left: 4px;
}

.search-box {
  width: 100%;
  padding: 10px 14px 10px 38px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--card);
  color: var(--text);
  outline: none;
  margin-bottom: 14px;
  transition: border-color 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23a89880' stroke-width='2'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.35-4.35'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 12px center;
}

.search-box:focus {
  border-color: var(--accent-light);
}

.room-label {
  font-size: 11px;
  color: var(--text-hint);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

/* ── Photo Grid ── */
.photo-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

@media (max-width: 380px) {
  .photo-grid {
    grid-template-columns: 1fr;
  }
}

.photo-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  transition: box-shadow 0.2s;
}

.photo-card:hover {
  box-shadow: var(--shadow);
}

.photo-thumb {
  background: var(--surface);
  height: 220px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  flex-shrink: 0;
  overflow: hidden;
}

.photo-thumb-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
  display: block;
}

.photo-thumb-icon {
  font-size: 28px;
  opacity: 0.2;
  line-height: 1;
  position: relative;
  z-index: 1;
}

.photo-status {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: 11px;
}

.s-ok {
  background: var(--success-bg);
  color: var(--success);
  border: 1px solid var(--success-border);
}

.s-partial {
  background: var(--warn-bg);
  color: var(--warn);
  border: 1px solid var(--warn-border);
}

.s-sold {
  background: var(--danger-bg);
  color: var(--danger);
  border: 1px solid var(--danger-border);
}

.photo-body {
  padding: 12px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.photo-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 17px;
  color: var(--accent-dark);
  margin-bottom: 4px;
  font-weight: 400;
  line-height: 1.2;
}

.photo-size {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.3px;
  margin-bottom: 6px;
}

.photo-sub {
  font-size: 11px;
  color: var(--text-hint);
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.photo-price {
  font-family: "Cormorant Garamond", serif;
  font-size: 20px;
  color: var(--accent);
  margin-bottom: 10px;
}

.edition-row {
  font-size: 12px;
  color: var(--text-muted);
  padding: 4px 0 4px 8px;
  border-left: 2px solid var(--accent-muted);
  margin-bottom: 3px;
  line-height: 1.3;
}

.edition-row .buyer {
  color: var(--text);
}

.photo-actions {
  margin-top: auto;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.btn-sell {
  padding: 7px 14px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s;
}

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

.btn-edit {
  padding: 7px 12px;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent-muted);
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-edit:hover {
  background: var(--surface);
}

/* ── Sales List ── */
.sale-item {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  transition: box-shadow 0.15s;
}

.sale-item:hover {
  box-shadow: var(--shadow);
}

.sale-buyer {
  font-size: 14px;
  color: var(--text);
  margin-bottom: 2px;
}

.sale-detail {
  font-size: 12px;
  color: var(--text-muted);
}

.sale-right {
  text-align: right;
  flex-shrink: 0;
}

.sale-price {
  font-family: "Cormorant Garamond", serif;
  font-size: 18px;
  color: var(--accent);
}

.sale-date {
  font-size: 11px;
  color: var(--text-hint);
  margin-top: 2px;
}

.empty-state {
  text-align: center;
  color: var(--text-muted);
  padding: 3rem 1rem;
  font-size: 14px;
}

.empty-icon {
  font-size: 36px;
  opacity: 0.2;
  margin-bottom: 12px;
}

/* ── Dashboard ── */
.stat-row {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat-card {
  flex: 1;
  min-width: 90px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
}

.stat-label {
  font-size: 10px;
  color: var(--text-hint);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 6px;
}

.stat-value {
  font-family: "Cormorant Garamond", serif;
  font-size: 26px;
  color: var(--accent-dark);
  font-weight: 400;
}

.section-title {
  font-size: 11px;
  color: var(--text-hint);
  letter-spacing: 1.5px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.room-stat {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 8px;
}

.room-stat-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.room-stat-name {
  font-family: "Cormorant Garamond", serif;
  font-size: 16px;
  color: var(--accent-dark);
}

.room-stat-theme {
  font-size: 12px;
  color: var(--text-hint);
  margin-left: 6px;
}

.room-stat-count {
  font-size: 13px;
  color: var(--success);
}

.progress-track {
  background: var(--border);
  border-radius: 4px;
  height: 6px;
  overflow: hidden;
}

.progress-fill {
  background: var(--accent-light);
  height: 100%;
  border-radius: 4px;
  transition: width 0.4s ease;
}

.room-stat-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 11px;
  color: var(--text-hint);
}

/* ── IBAN Block ── */
.iban-block {
  margin: 14px 0 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px 16px;
}

.iban-row {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-top: 10px;
}

.iban-qr-wrap {
  flex-shrink: 0;
}

.iban-qr {
  width: 92px;
  height: 92px;
  border-radius: 12px;
  background: #fff;
  display: block;
}

.iban-label {
  font-size: 10px;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--text-hint);
  margin-bottom: 6px;
}

.iban-value {
  font-size: 13px;
  color: var(--text);
  word-break: break-all;
  line-height: 1.35;
}

.iban-missing {
  margin-top: 10px;
  font-size: 13px;
  color: var(--text-muted);
}

/* ── Modal ── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: var(--modal-bg);
  z-index: 200;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fadeIn 0.15s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.modal-sheet {
  background: var(--card);
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 560px;
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px 20px 36px;
  animation: slideUp 0.2s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal-center {
  align-items: center;
  padding: 16px;
}

.modal-box {
  background: var(--card);
  border-radius: 16px;
  width: 100%;
  max-width: 400px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 24px 20px;
  animation: slideUp 0.2s ease;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}

.modal-title {
  font-family: "Cormorant Garamond", serif;
  font-size: 22px;
  color: var(--accent-dark);
  font-weight: 400;
}

.modal-sub {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.btn-close {
  font-size: 22px;
  color: var(--text-muted);
  background: none;
  border: none;
  cursor: pointer;
  line-height: 1;
  padding: 0 2px;
}

.form-label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 14px;
  margin-bottom: 5px;
  letter-spacing: 0.3px;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 14px;
  background: var(--bg);
  color: var(--text);
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--accent-light);
}

textarea.form-input {
  resize: vertical;
  min-height: 72px;
}

.form-error {
  font-size: 13px;
  color: var(--danger);
  margin-top: 10px;
}

.btn-save {
  width: 100%;
  margin-top: 20px;
  padding: 13px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-family: "Cormorant Garamond", serif;
  font-size: 18px;
  cursor: pointer;
  transition: background 0.15s;
}

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

.btn-save:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.detail-row {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.detail-key {
  font-size: 13px;
  color: var(--text-muted);
  width: 80px;
  flex-shrink: 0;
}

.detail-val {
  font-size: 13px;
  color: var(--text);
  word-break: break-word;
}

.btn-danger-full {
  width: 100%;
  margin-top: 16px;
  padding: 11px;
  background: var(--danger);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  cursor: pointer;
  transition: opacity 0.15s;
}

.btn-danger-full:hover {
  opacity: 0.85;
}

.hidden {
  display: none !important;
}

.fade {
  animation: fadeIn 0.2s ease;
}
