:root {
  --atlas-blue: #0758a6;
  --atlas-blue-dark: #093f75;
  --atlas-ink: #12213a;
  --atlas-muted: #60708a;
  --atlas-line: #cad7e8;
  --atlas-soft: #f2f6fb;
  --atlas-danger: #b93d2e;
  --atlas-success: #18794e;
  --sidebar-width: 244px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; font-family: Arial, sans-serif; color: var(--atlas-ink); background: #edf2f8; }
body.upload-locked { overflow: hidden; }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
[hidden] { display: none !important; }

.login-view { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--atlas-line); padding: 30px; box-shadow: 0 18px 48px rgba(19, 45, 79, .12); }
.login-logo { width: 150px; display: block; margin: 0 auto 24px; }
.login-card h1 { margin: 0 0 8px; text-align: center; }
.login-card p { color: var(--atlas-muted); text-align: center; }
.login-card form { display: grid; gap: 14px; }
.login-card label, .photos-toolbar label { display: grid; gap: 6px; font-size: 13px; font-weight: 700; }
input, select, textarea { width: 100%; border: 1px solid #bfcde0; background: #fff; color: var(--atlas-ink); padding: 10px 11px; border-radius: 5px; }
textarea { min-height: 76px; resize: vertical; }
.form-message { color: var(--atlas-danger); }

.topbar { position: sticky; top: 0; z-index: 20; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 10px 28px; background: #fff; border-bottom: 1px solid var(--atlas-line); }
.topbar-brand, .topbar-actions { display: flex; align-items: center; gap: 14px; }
.topbar-brand img { width: 190px; max-height: 58px; object-fit: contain; }
.topbar-brand span { width: 1px; height: 44px; background: var(--atlas-line); }
.topbar-brand strong { font-size: 19px; }
.topbar-actions { flex-wrap: wrap; justify-content: flex-end; }
.session-pill { padding: 9px 14px; color: var(--atlas-blue); background: #eef6ff; border-radius: 18px; font-weight: 700; }
.ghost-button, .primary-action, .icon-button, .danger-button { border: 1px solid var(--atlas-line); border-radius: 5px; padding: 10px 14px; background: #fff; color: var(--atlas-ink); font-weight: 700; }
.primary-action { border-color: var(--atlas-blue); color: #fff; background: var(--atlas-blue); }
.primary-action:hover { background: var(--atlas-blue-dark); }
.danger-button { color: var(--atlas-danger); border-color: #e2b8b3; }
.icon-button { width: 38px; height: 38px; padding: 0; display: inline-grid; place-items: center; font-size: 19px; }
.icon-button.rotate-left, .icon-button.rotate-right { width: 48px; font-size: 12px; }

.app-shell { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: calc(100vh - 72px); }
.side-nav { position: sticky; top: 72px; height: calc(100vh - 72px); overflow-y: auto; display: flex; flex-direction: column; padding: 22px 8px 12px; background: #fff; border-right: 1px solid var(--atlas-line); }
.side-nav nav { display: grid; gap: 3px; }
.side-nav a { display: grid; grid-template-columns: 32px minmax(0, 1fr); align-items: center; min-height: 38px; padding: 7px 11px; color: var(--atlas-ink); text-decoration: none; font-size: 13px; font-weight: 700; border-radius: 5px; }
.side-nav a:hover, .side-nav a.active { color: var(--atlas-blue); background: #eaf3fd; }
.side-nav a.active { box-shadow: inset 3px 0 var(--atlas-blue); }
.nav-icon::before { display: inline-grid; place-items: center; width: 22px; height: 22px; font-size: 9px; font-weight: 800; color: #0a3767; }
.nav-icon.home::before { content: "IN"; }.nav-icon.users::before { content: "CL"; }.nav-icon.folder::before { content: "PR"; }.nav-icon.layers::before { content: "GT"; }.nav-icon.lab::before { content: "LB"; }.nav-icon.admin::before { content: "AD"; }.nav-icon.chart::before { content: "TB"; }.nav-icon.mobile::before { content: "MV"; }.nav-icon.field::before { content: "RV"; }.nav-icon.audit::before { content: "SG"; }.nav-icon.bell::before { content: "NT"; }.nav-icon.automation::before { content: "AU"; }.nav-icon.file::before { content: "IF"; }.nav-icon.map::before { content: "MP"; }.nav-icon.chat::before { content: "CH"; }.nav-icon.camera::before { content: "FO"; }
.db-status { margin-top: auto; display: flex; gap: 8px; align-items: center; padding: 14px 10px 4px; border-top: 1px solid var(--atlas-line); }
.db-status div { display: grid; }.db-status small, .version-note { color: var(--atlas-muted); }.version-note { padding: 6px 10px; }

.photos-content { min-width: 0; padding: 26px 30px 50px; }
.breadcrumbs { display: flex; gap: 10px; align-items: center; margin-bottom: 20px; color: var(--atlas-muted); font-size: 13px; }
.module-heading, .photos-toolbar, .summary-strip { background: #fff; border: 1px solid var(--atlas-line); border-radius: 6px; }
.module-heading { display: flex; justify-content: space-between; gap: 28px; align-items: end; padding: 24px 28px; }
.module-heading h1 { margin: 3px 0 7px; font-size: 28px; }.module-heading p { margin: 0; color: var(--atlas-muted); }.eyebrow { color: var(--atlas-blue) !important; font-size: 11px; font-weight: 800; }
.project-select-wrap { width: min(520px, 45%); display: grid; gap: 6px; font-size: 12px; font-weight: 700; }
.photos-toolbar { display: grid; grid-template-columns: minmax(280px, 1.3fr) minmax(170px, .5fr) minmax(540px, 1.2fr); align-items: end; gap: 18px; padding: 18px; margin-top: 14px; }
.upload-dropzone { min-height: 76px; display: flex; align-items: center; gap: 14px; padding: 14px; border: 1px dashed #91acd0; background: #f7faff; border-radius: 6px; cursor: pointer; }
.upload-dropzone:hover, .upload-dropzone.dragging { border-color: var(--atlas-blue); background: #eaf4ff; }
.upload-symbol { width: 38px; height: 38px; display: grid; place-items: center; border-radius: 50%; background: var(--atlas-blue); color: #fff; font-size: 25px; }
.upload-dropzone div { display: grid; gap: 5px; }.upload-dropzone small { color: var(--atlas-muted); }
.export-controls { display: grid; grid-template-columns: minmax(180px, 1fr) repeat(5, max-content); gap: 10px; align-items: end; }
.export-controls button { white-space: nowrap; }
.export-controls .title-toggle { min-height: 40px; display: flex; flex-direction: row; align-items: center; gap: 8px; white-space: nowrap; }
.export-controls .title-toggle input { width: auto; margin: 0; }
.summary-strip { display: grid; grid-template-columns: repeat(4, minmax(120px, 170px)) minmax(260px, 1fr); gap: 1px; overflow: hidden; margin-top: 14px; }
.summary-strip > div, .summary-strip > p { margin: 0; padding: 14px 18px; background: #fff; }
.summary-strip > div { display: grid; gap: 3px; border-right: 1px solid var(--atlas-line); }.summary-strip span { color: var(--atlas-muted); font-size: 12px; }.summary-strip strong { font-size: 22px; }.summary-strip p { color: var(--atlas-muted); align-self: center; }

.photos-gallery { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 18px; }
.photo-card { min-width: 0; overflow: hidden; background: #fff; border: 1px solid var(--atlas-line); border-radius: 6px; box-shadow: 0 4px 12px rgba(23, 52, 88, .06); }
.photo-card.excluded { opacity: .67; }
.photo-preview { position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; overflow: hidden; background: #dfe7f1; }
.photo-preview img { width: 100%; height: 100%; object-fit: contain; background: #e7edf4; }
.photo-order { position: absolute; top: 9px; left: 9px; min-width: 30px; height: 30px; display: grid; place-items: center; padding: 0 7px; background: rgba(9, 47, 84, .9); color: #fff; font-weight: 800; border-radius: 4px; }
.orientation-badge { position: absolute; right: 9px; top: 9px; max-width: calc(100% - 56px); padding: 5px 7px; color: #fff; font-size: 10px; font-weight: 800; border-radius: 3px; }
.orientation-badge.corrected { background: rgba(24, 121, 78, .92); }
.orientation-badge.review { background: rgba(166, 99, 15, .94); }
.orientation-badge.confirmed { background: rgba(23, 105, 72, .95); }
.orientation-badge.learned { background: rgba(7, 88, 166, .95); }
.orientation-badge.pending { background: rgba(166, 70, 25, .95); }
.orientation-badge.suggestion { background: rgba(94, 69, 145, .95); }
.photo-card-body { display: grid; gap: 10px; padding: 14px; }
.photo-meta-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(130px, .7fr); gap: 10px; }
.photo-card label { display: grid; gap: 5px; font-size: 11px; font-weight: 800; color: #3d4c62; }
.photo-card input, .photo-card select, .photo-card textarea { padding: 8px 9px; font-size: 13px; }
.include-toggle { display: flex !important; align-items: center; gap: 8px !important; }.include-toggle input { width: auto; }
.photo-actions { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; padding-top: 2px; }.photo-actions .save-photo { margin-left: auto; }
.photo-actions .confirm-orientation, .photo-actions .apply-suggestion, .photo-actions .remove-learning { padding: 9px 10px; font-size: 12px; }
.empty-state { grid-column: 1 / -1; min-height: 180px; display: grid; place-items: center; padding: 28px; text-align: center; color: var(--atlas-muted); background: #fff; border: 1px dashed #aebed3; border-radius: 6px; }
.upload-progress-overlay { position: fixed; inset: 0; z-index: 250; display: grid; place-items: center; padding: 22px; background: rgba(9, 31, 58, .76); backdrop-filter: blur(3px); }
.upload-progress-card { width: min(520px, 100%); display: grid; gap: 14px; padding: 28px; background: #fff; border: 1px solid #9fb5cf; border-radius: 6px; box-shadow: 0 24px 70px rgba(0, 0, 0, .28); }
.upload-progress-icon { width: 48px; height: 48px; display: grid; place-items: center; color: #fff; background: var(--atlas-blue); border-radius: 50%; font-size: 30px; font-weight: 800; }
.upload-progress-card h2 { margin: 0; font-size: 22px; }
.upload-progress-card p { min-height: 20px; margin: 0; overflow-wrap: anywhere; color: #40516a; }
.upload-progress-card small { color: var(--atlas-muted); line-height: 1.45; }
.upload-progress-meta { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.upload-progress-meta strong { color: var(--atlas-blue-dark); font-size: 17px; }
.upload-progress-meta span { color: var(--atlas-muted); font-weight: 700; }
.upload-progress-track { height: 14px; overflow: hidden; background: #dce5f0; border: 1px solid #bac9dc; border-radius: 3px; }
.upload-progress-track span { position: relative; display: block; width: 0; height: 100%; background: var(--atlas-blue); transition: width .24s ease; }
.upload-progress-track span::after { content: ""; position: absolute; inset: 0; background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, .55) 45%, transparent 70%); transform: translateX(-100%); animation: upload-progress-shimmer 1.2s linear infinite; }
@keyframes upload-progress-shimmer { to { transform: translateX(100%); } }
.toast { position: fixed; right: 22px; bottom: 22px; z-index: 100; max-width: min(430px, calc(100vw - 44px)); padding: 13px 16px; color: #fff; background: #16395f; border-radius: 5px; box-shadow: 0 12px 30px rgba(0, 0, 0, .2); }.toast.error { background: #9c3027; }

@media (max-width: 1320px) {
  .photos-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .photos-toolbar { grid-template-columns: 1fr 240px; }.export-controls { grid-column: 1 / -1; }
}
@media (max-width: 1020px) {
  :root { --sidebar-width: 190px; }
  .photos-content { padding: 20px; }.module-heading { align-items: stretch; flex-direction: column; }.project-select-wrap { width: 100%; }
  .summary-strip { grid-template-columns: repeat(2, 1fr); }.summary-strip p { grid-column: 1 / -1; border-top: 1px solid var(--atlas-line); }
}
@media (max-width: 760px) {
  body[data-module="fotos"] .topbar { min-height: 58px; align-items: center; flex-wrap: nowrap; padding: 8px 12px; }
  body[data-module="fotos"] .topbar-brand { width: auto !important; min-width: 100px; flex: 1 1 auto; flex-wrap: nowrap; gap: 7px; }
  body[data-module="fotos"] .topbar-brand img { flex: 0 0 100px; width: 100px !important; height: auto !important; max-height: 42px; object-fit: contain; }
  body[data-module="fotos"] .topbar-brand strong { display: none; }
  body[data-module="fotos"] .topbar-brand span, body[data-module="fotos"] .session-pill { display: none; }
  body[data-module="fotos"] .topbar-actions { width: auto !important; flex: 0 0 auto; flex-wrap: nowrap; gap: 5px; }
  body[data-module="fotos"] .topbar-actions button { padding: 8px 9px; }
  .app-shell { display: block; }.side-nav { position: static; width: 100%; height: auto; overflow-x: auto; padding: 5px; }.side-nav nav { display: flex; min-width: max-content; }.side-nav a { grid-template-columns: 25px auto; }.db-status, .version-note { display: none; }
  .photos-content { padding: 14px; }.module-heading { padding: 18px; }.module-heading h1 { font-size: 23px; }
  .photos-toolbar, .photos-gallery { grid-template-columns: 1fr; }.photos-toolbar { align-items: stretch; }.export-controls { grid-column: auto; grid-template-columns: 1fr; }
  .summary-strip { grid-template-columns: 1fr 1fr; }.summary-strip p { grid-column: 1 / -1; }
  .photo-meta-row { grid-template-columns: 1fr; }
  .upload-progress-overlay { padding: 14px; }.upload-progress-card { padding: 22px 18px; }.upload-progress-card h2 { font-size: 20px; }
}
