*{box-sizing:border-box}
:root{font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Tahoma,Arial,sans-serif;color:#1d1d1f;background:#f5f5f7}
body{margin:0;min-height:100vh;background:linear-gradient(180deg,#f7f8fb,#eef1f6)}
button,input,select{font:inherit}
.app{width:min(980px,calc(100% - 28px));margin:30px auto 60px}
.hero{display:flex;align-items:center;gap:14px;margin-bottom:20px}
.logo{width:58px;height:58px;border-radius:18px;background:#fff;display:grid;place-items:center;font-size:30px;box-shadow:0 8px 30px #0000000d}
h1{font-size:27px;margin:0 0 5px}.hero p{margin:0;color:#6e6e73}
.panel{background:#fff;border:1px solid #e7e7ea;border-radius:22px;padding:22px;box-shadow:0 12px 40px #0000000a;margin-bottom:16px}
.hidden{display:none!important}
.drop-zone{text-align:center;border:2px dashed #d7d9df;border-radius:18px;padding:32px 18px;transition:.2s}
.drop-zone.drag{border-color:#007aff;background:#f2f8ff}.drop-icon{font-size:42px}.drop-zone h2{margin:8px 0}
.drop-zone p{color:#777;margin:0 0 18px}.drop-zone small{display:block;color:#8a8a8e;margin-top:12px}
.primary,.secondary{border:0;border-radius:12px;padding:11px 17px;text-decoration:none;cursor:pointer;font-weight:700;display:inline-flex;align-items:center;justify-content:center}
.primary{background:#007aff;color:#fff}.primary:hover{filter:brightness(.96)}.primary:disabled{opacity:.45;cursor:not-allowed}
.secondary{background:#eef4ff;color:#0066d6}.secondary.google{background:#f3f3f5;color:#333}
.summary-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:10px;margin-bottom:18px}
.metric{border:1px solid #e7e7eb;background:#fafafa;border-radius:14px;padding:13px}.metric strong{display:block;font-size:22px}.metric span{font-size:12px;color:#777}
.metric.good strong{color:#198754}.metric.warn strong{color:#b7791f}
.toolbar{display:flex;justify-content:space-between;align-items:center;gap:12px;margin-bottom:12px}
.select-all{font-weight:700;display:flex;gap:9px;align-items:center}.select-all input,.place-check{width:19px;height:19px;accent-color:#007aff}
.stats{background:#f2f2f7;border-radius:999px;padding:7px 12px;color:#555;font-size:14px}
.filters{display:grid;grid-template-columns:1fr 190px;gap:10px;margin-bottom:14px}.filters input,.filters select,.rename{width:100%;border:1px solid #dcdde2;border-radius:12px;padding:12px 14px;outline:none;background:#fafafa}
.filters input:focus,.filters select:focus,.rename:focus{border-color:#007aff;background:#fff;box-shadow:0 0 0 3px #007aff18}
.places{display:grid;gap:9px;max-height:520px;overflow:auto;padding-left:4px}
.place{display:grid;grid-template-columns:auto 1fr auto;gap:11px;align-items:center;border:1px solid #e9e9ed;border-radius:14px;padding:12px;background:#fff}
.place:hover{background:#fbfbfd}.place.unresolved{border-color:#efd9b2;background:#fffaf2}
.place-main{min-width:0}.place-name{font-weight:750;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.place-address{font-size:12px;color:#67676c;margin-top:4px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.place-coords{font-size:12px;color:#8a8a8e;margin-top:3px;direction:ltr;text-align:right}.badge{display:inline-block;font-size:11px;border-radius:999px;padding:3px 7px;margin-right:6px;background:#eef5ff;color:#0066d6}
.badge.warn{background:#fff1d6;color:#8a5a00}.preview-btn{border:0;background:#f0f6ff;color:#0066d6;border-radius:10px;padding:8px 10px;cursor:pointer;white-space:nowrap}
.footer-actions{display:flex;justify-content:space-between;align-items:center;gap:14px;border-top:1px solid #eee;margin-top:18px;padding-top:18px}
.summary{color:#666}.large{padding:13px 20px}
.modal{position:fixed;inset:0;background:#0008;display:grid;place-items:center;padding:18px;z-index:10}.modal-card{position:relative;width:min(600px,100%);max-height:92vh;overflow:auto;background:#fff;border-radius:22px;padding:24px;box-shadow:0 24px 80px #0005}
.close{position:absolute;left:15px;top:12px;border:0;background:#f1f1f4;width:34px;height:34px;border-radius:50%;font-size:24px;cursor:pointer}
.modal-head{padding-left:45px}.modal-card h2{margin:0 0 7px}.status-pill{display:inline-block;font-size:12px;border-radius:999px;padding:4px 8px;background:#f2f2f7;color:#555}
.address{color:#555;margin:10px 0 3px}.coords{direction:ltr;text-align:right;color:#777;font-size:13px;margin-top:4px}
.map-placeholder{min-height:210px;border-radius:17px;margin:18px 0;background:linear-gradient(135deg,#e7f1e7,#e9eef8);display:grid;place-items:center;text-align:center;padding:20px}
.map-placeholder strong{display:block;font-size:18px}.map-placeholder p{color:#666;font-size:13px;max-width:380px}
.map-placeholder button{margin-top:10px}.map-frame{width:100%;height:280px;border:0;border-radius:17px;margin:18px 0;background:#eee}
.unresolved-box{border:1px solid #f0d8a9;background:#fff9ed;border-radius:16px;padding:18px;margin:18px 0}.unresolved-box h3{margin:0 0 8px}.unresolved-box p{color:#6c5a35;margin:0;font-size:14px}
.field-label{display:block;font-weight:700;margin-bottom:7px}.modal-actions{display:flex;gap:10px;margin-top:14px;flex-wrap:wrap}.modal-actions>*{flex:1}
.privacy-note{font-size:12px;color:#8a8a8e;margin:12px 0 0}
@media(max-width:700px){.summary-grid{grid-template-columns:repeat(2,1fr)}.filters{grid-template-columns:1fr}.app{margin-top:18px}.panel{padding:15px}.place{grid-template-columns:auto 1fr}.preview-btn{grid-column:2;width:max-content}.footer-actions{align-items:stretch;flex-direction:column}.large{width:100%}}

.manual-recovery{border:1px solid #d9e7ff;background:#f7fbff;border-radius:16px;padding:16px;margin:16px 0}
.manual-recovery h3{margin:0 0 6px}
.manual-recovery p{margin:0 0 10px;color:#5f6670;font-size:13px}
.recovery-row{display:grid;grid-template-columns:1fr auto;gap:8px}
.recovery-row input{width:100%;border:1px solid #dcdde2;border-radius:11px;padding:11px 12px;outline:none;background:#fff;direction:ltr;text-align:left}
.recovery-message{margin-top:8px!important;font-weight:700}
.recovery-message.ok{color:#198754}.recovery-message.err{color:#b42318}
@media(max-width:600px){.recovery-row{grid-template-columns:1fr}.recovery-row button{width:100%}}

.manual-picker{margin-top:14px;border-top:1px solid #dce8f7;padding-top:14px}
.picker-head strong{font-size:15px}
.picker-head p{margin:5px 0 10px!important}
.picker-map{height:310px;border-radius:14px;overflow:hidden;background:#e9edf2;border:1px solid #d7dce3;direction:ltr}
.picker-footer{display:flex;align-items:center;justify-content:space-between;gap:10px;margin-top:10px}
.picker-footer span{direction:ltr;text-align:left;font-size:13px;color:#5f6670}
.manual-map-loading{height:100%;display:grid;place-items:center;color:#666;text-align:center;padding:20px}
@media(max-width:600px){.picker-footer{align-items:stretch;flex-direction:column}.picker-footer button{width:100%}}

.danger-soft{
  border:1px solid #ffd0d0;
  background:#fff3f3;
  color:#b42318;
  border-radius:12px;
  padding:11px 17px;
  cursor:pointer;
  font-weight:700;
  display:inline-flex;
  align-items:center;
  justify-content:center
}
.danger-soft:hover{background:#ffeaea}
.danger-soft.active{
  border-color:#d7d7dc;
  background:#f3f3f5;
  color:#555
}
.place.excluded{opacity:.68;background:#f8f8f9}
.badge.excluded{background:#f1f1f3;color:#666}


/* v7 — Google Takeout help */
.help-panel{padding:0;overflow:hidden}
.help-details{width:100%}
.help-details summary{
  list-style:none;
  cursor:pointer;
  padding:18px 22px;
  font-weight:800;
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:12px;
  user-select:none
}
.help-details summary::-webkit-details-marker{display:none}
.help-details summary::after{
  content:"＋";
  width:30px;
  height:30px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:#f2f2f7;
  color:#555;
  flex:0 0 auto
}
.help-details[open] summary::after{content:"−"}
.help-content{
  border-top:1px solid #ececf0;
  padding:18px 22px 22px;
  color:#4f5055
}
.help-content p{margin:0 0 12px;line-height:1.8}
.help-content ol{margin:0 0 16px;padding-right:24px;line-height:1.9}
.help-content li{margin:4px 0}
.help-note{font-size:13px;color:#777}
.takeout-link{width:max-content}

/* v7 — stronger mobile layout */
@media(max-width:700px){
  body{background:#f5f5f7}
  .app{width:100%;margin:0 auto 30px;padding:12px}
  .hero{align-items:flex-start;margin:6px 2px 16px}
  .logo{width:48px;height:48px;border-radius:15px;font-size:25px;flex:0 0 auto}
  h1{font-size:21px;line-height:1.35}
  .hero p{font-size:13px;line-height:1.6}
  .panel{border-radius:18px;padding:14px;margin-bottom:12px}
  .drop-zone{padding:24px 12px;border-radius:15px}
  .drop-icon{font-size:36px}
  .drop-zone h2{font-size:19px}
  .primary,.secondary,.danger-soft{min-height:44px}
  .toolbar{align-items:stretch;flex-direction:column}
  .stats{width:max-content;max-width:100%}
  .summary-grid{grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
  .metric{padding:11px}
  .metric strong{font-size:20px}
  .filters{grid-template-columns:minmax(0,1fr)}
  .filters input,.filters select,.rename{font-size:16px;min-height:46px}
  .places{max-height:none;overflow:visible;padding-left:0}
  .place{
    grid-template-columns:auto minmax(0,1fr);
    gap:9px;
    padding:11px
  }
  .preview-btn{
    grid-column:1 / -1;
    width:100%;
    min-height:42px
  }
  .place-name,.place-address{white-space:normal;overflow:visible;text-overflow:clip;overflow-wrap:anywhere}
  .footer-actions{flex-direction:column;align-items:stretch}
  .footer-actions .summary{text-align:center;line-height:1.7}
  .large{width:100%;min-height:48px}

  .help-details summary{padding:16px;font-size:14px}
  .help-content{padding:16px}
  .help-content ol{padding-right:20px}
  .takeout-link{width:100%}

  .modal{
    padding:8px;
    align-items:end
  }
  .modal-card{
    width:100%;
    max-height:94dvh;
    border-radius:20px 20px 14px 14px;
    padding:20px 14px 16px;
    overscroll-behavior:contain
  }
  .close{
    position:sticky;
    float:left;
    left:auto;
    top:0;
    z-index:30;
    width:38px;
    height:38px;
    margin-bottom:-38px
  }
  .modal-head{padding-left:44px;min-height:40px}
  .modal-card h2{font-size:20px;overflow-wrap:anywhere}
  .address{line-height:1.6;overflow-wrap:anywhere}
  .coords{overflow-wrap:anywhere}
  .map-placeholder{min-height:180px;margin:14px 0;padding:14px}
  .map-frame{height:250px;margin:14px 0}
  .manual-recovery{padding:13px;margin:14px 0}
  .recovery-row{grid-template-columns:minmax(0,1fr)}
  .recovery-row input{font-size:16px;min-height:46px}
  .recovery-row button{width:100%}
  .picker-map{height:260px}
  .picker-footer{flex-direction:column;align-items:stretch}
  .picker-footer button{width:100%}
  .modal-actions{display:grid;grid-template-columns:1fr;gap:8px}
  .modal-actions>*{width:100%}
  .privacy-note{line-height:1.6}
}

@media(max-width:380px){
  .app{padding:8px}
  .summary-grid{grid-template-columns:1fr}
  h1{font-size:19px}
  .hero{gap:10px}
  .logo{width:44px;height:44px}
}

/* Keep the dialog open when the shaded background is touched/clicked.
   Closing is intentionally available only through × or after Save. */
.modal{overscroll-behavior:contain}


/* v8 — fixed Google Takeout help */
.takeout-fab{
  position:fixed;
  right:18px;
  bottom:18px;
  z-index:900;
  border:1px solid #dfe5ef;
  background:rgba(255,255,255,.96);
  color:#1268d6;
  box-shadow:0 8px 28px rgba(0,0,0,.12);
  border-radius:999px;
  min-height:46px;
  padding:8px 16px;
  display:flex;
  align-items:center;
  gap:8px;
  cursor:pointer;
  font:inherit;
  font-weight:800;
  backdrop-filter:blur(10px)
}
.takeout-fab>span:first-child{
  width:27px;
  height:27px;
  border-radius:50%;
  display:grid;
  place-items:center;
  background:#eef5ff;
  font-size:18px
}
.takeout-help-card{max-width:650px}
.takeout-steps{line-height:1.9}
.takeout-steps ol{padding-right:25px;margin:10px 0 16px}
.takeout-steps li{margin:6px 0}
.takeout-open{display:flex;text-decoration:none;width:max-content}
body{padding-bottom:76px}

@media(max-width:700px){
  .takeout-fab{
    right:12px;
    bottom:12px;
    min-height:42px;
    padding:7px 12px;
    font-size:12px;
    max-width:calc(100vw - 24px)
  }
  .takeout-fab>span:first-child{width:24px;height:24px;font-size:16px}
  .takeout-help-card{max-height:92dvh}
  .takeout-steps{font-size:14px}
  .takeout-steps ol{padding-right:21px}
  .takeout-open{width:100%;justify-content:center}
  body{padding-bottom:70px}
}
